From 3e6018aa45de893b29fd6fa58714f82b4c7d9723 Mon Sep 17 00:00:00 2001 From: Stephen Mardson McQuay Date: Wed, 30 Mar 2011 23:15:37 -0600 Subject: [PATCH] added explanation for extra sleeping in while loop --- bin/slave.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/slave.py b/bin/slave.py index aafe5bf..e2d4cf1 100644 --- a/bin/slave.py +++ b/bin/slave.py @@ -63,5 +63,9 @@ if __name__ == '__main__': shutdown = False 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) + shutdown = work(inq, outq, g, myname)