Revision 2db05c94 lib/workerpool.py
b/lib/workerpool.py | ||
---|---|---|
354 | 354 |
if not self._tasks: |
355 | 355 |
logging.debug("Waiting for tasks") |
356 | 356 |
|
357 |
# wait() releases the lock and sleeps until notified |
|
358 |
self._pool_to_worker.wait() |
|
357 |
while True: |
|
358 |
# wait() releases the lock and sleeps until notified |
|
359 |
self._pool_to_worker.wait() |
|
359 | 360 |
|
360 |
logging.debug("Notified while waiting") |
|
361 |
logging.debug("Notified while waiting")
|
|
361 | 362 |
|
362 |
# Were we woken up in order to terminate? |
|
363 |
if self._ShouldWorkerTerminateUnlocked(worker): |
|
364 |
return _TERMINATE |
|
363 |
# Were we woken up in order to terminate?
|
|
364 |
if self._ShouldWorkerTerminateUnlocked(worker):
|
|
365 |
return _TERMINATE
|
|
365 | 366 |
|
366 |
if not self._tasks: |
|
367 |
# Spurious notification, ignore |
|
368 |
return None |
|
367 |
if self._tasks: |
|
368 |
break |
|
369 | 369 |
|
370 | 370 |
# Get task from queue and tell pool about it |
371 | 371 |
try: |
Also available in: Unified diff