Beispiel #1
0
def main():
    #pass,user,db,host
    db = DBC.DatabaseFacade('ooad', 'plant', 'OOADProject', '127.0.0.1')
    #need to add an appropriate check to setting up the database
    #db.SetUp()
    #db.AddPlantRecords()
    #return

    #This holds all of the threads
    threads = []
    #conditional variable to protect the database
    conditionalvar = threading.Condition()
    #a sentinal for running the app
    running = True
    #conditional varialbe to protect the sentinel
    isrun = threading.Condition()

    #create the web app as a thread
    t = threading.Thread(target=setUpWebApp,
                         args=(db, conditionalvar, isrun, running))
    threads.append(t)
    t.start()

    #create a thread does data input
    d = threading.Thread(target=setUpDataService,
                         args=(db, conditionalvar, isrun, running))
    threads.append(d)
    d.start()

    #create a thread that listens to the user
    u = threading.Thread(target=userListner,
                         args=(db, conditionalvar, isrun, running))
    threads.append(u)
    u.start()