made it update the masterq only if the master told it to die
This commit is contained in:
parent
36ba080d14
commit
1e612ca070
@ -20,10 +20,10 @@ if sys.argv[1].startswith("st"):
|
|||||||
print " masterq : %d" % mq.qsize()
|
print " masterq : %d" % mq.qsize()
|
||||||
print " slavesq : %d" % sq.qsize()
|
print " slavesq : %d" % sq.qsize()
|
||||||
|
|
||||||
if sys.argv[1] == 'teardown':
|
if sys.argv[1] == 'slay':
|
||||||
for i in xrange(mq.qsize()):
|
for i in xrange(mq.qsize()):
|
||||||
print i, "killing", mq.get()
|
print i, "killing", mq.get()
|
||||||
sq.put("teardown")
|
sq.put("slay")
|
||||||
|
|
||||||
if sys.argv[1] == 'clear':
|
if sys.argv[1] == 'clear':
|
||||||
for i in xrange(tq.qsize()): print tq.get()
|
for i in xrange(tq.qsize()): print tq.get()
|
||||||
|
@ -55,13 +55,17 @@ if __name__ == '__main__':
|
|||||||
if options.verbose:
|
if options.verbose:
|
||||||
print myname
|
print myname
|
||||||
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
# indicate that I am loaded up, and ready for workload
|
# indicate that I am loaded up, and ready for workload
|
||||||
masterq.put(myname)
|
masterq.put(myname)
|
||||||
# wait for master's start signal
|
# wait for master's start signal
|
||||||
action = slavesq.get()
|
action = slavesq.get()
|
||||||
if action == "teardown":
|
if action == "teardown":
|
||||||
|
# I take it back; I'm not ready!
|
||||||
|
masterq.get()
|
||||||
|
break
|
||||||
|
elif action == "slay":
|
||||||
break
|
break
|
||||||
|
|
||||||
while not tasksq.empty():
|
while not tasksq.empty():
|
||||||
|
Loading…
Reference in New Issue
Block a user