Code Feedback

snoe case.nelson at gmail.com
Mon Feb 6 18:40:24 EST 2006


I believe the while 1: pass is there to keep the main thread alive
until all the readers are done. If you want the program to end after
the readers are done you can append them all to a list then iterate
through and wait for the threads to join()

if __name__=="__main__":

    library = Library()
    readers = input("Number of Readers?")
    readerlist = []
    for i in range(1,readers):
        newReader = Reader(library, "Reader" + str (i),
random.randint(1,7), random.randint(1,7))
        newReader.start()
        readerlist.append(newReader)
    for reader in readerlist:
        reader.join()




More information about the Python-list mailing list