made it update the masterq only if the master told it to die

This commit is contained in:
Stephen McQuay 2011-04-02 01:20:59 -06:00
parent 36ba080d14
commit 1e612ca070
2 changed files with 7 additions and 3 deletions

View File

@ -20,10 +20,10 @@ if sys.argv[1].startswith("st"):
print " masterq : %d" % mq.qsize()
print " slavesq : %d" % sq.qsize()
if sys.argv[1] == 'teardown':
if sys.argv[1] == 'slay':
for i in xrange(mq.qsize()):
print i, "killing", mq.get()
sq.put("teardown")
sq.put("slay")
if sys.argv[1] == 'clear':
for i in xrange(tq.qsize()): print tq.get()

View File

@ -62,6 +62,10 @@ if __name__ == '__main__':
# wait for master's start signal
action = slavesq.get()
if action == "teardown":
# I take it back; I'm not ready!
masterq.get()
break
elif action == "slay":
break
while not tasksq.empty():