added explanation for extra sleeping in while loop

This commit is contained in:
Stephen McQuay 2011-03-30 23:15:37 -06:00
parent 16bfca3bd5
commit 3e6018aa45

View File

@ -63,5 +63,9 @@ if __name__ == '__main__':
shutdown = False shutdown = False
while not shutdown: while not shutdown:
# this sleep prevents a race condition in work(): someone putting
# themselves in as ready, pulling someone elses's shutdown signal, then
# putting their name in again.
time.sleep(5) time.sleep(5)
shutdown = work(inq, outq, g, myname) shutdown = work(inq, outq, g, myname)