diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-03 11:17:06 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-07-03 11:17:06 (GMT) |
commit | 1c405b3e60d3237de8a4f6f338d42fdd0b84f5e7 (patch) | |
tree | 0ac48df2123b97936d03a899d20f01b5fa9a64c8 /Lib/concurrent/futures | |
parent | 4334d740ed1ee6bbdad2e6df88ac11453d5f8142 (diff) | |
download | cpython-1c405b3e60d3237de8a4f6f338d42fdd0b84f5e7.zip cpython-1c405b3e60d3237de8a4f6f338d42fdd0b84f5e7.tar.gz cpython-1c405b3e60d3237de8a4f6f338d42fdd0b84f5e7.tar.bz2 |
Followup to 51c1f2cedb96 (and issue #12456):
qsize() raises NotImplementedError on OS X, don't use it.
Diffstat (limited to 'Lib/concurrent/futures')
-rw-r--r-- | Lib/concurrent/futures/process.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 689f9ba..41e1320 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -204,7 +204,7 @@ def _queue_management_worker(executor_reference, # This is an upper bound nb_children_alive = sum(p.is_alive() for p in processes.values()) for i in range(0, nb_children_alive): - call_queue.put(None) + call_queue.put_nowait(None) # If .join() is not called on the created processes then # some multiprocessing.Queue methods may deadlock on Mac OS X. for p in processes.values(): @@ -265,18 +265,18 @@ def _queue_management_worker(executor_reference, # - The executor that owns this worker has been collected OR # - The executor that owns this worker has been shutdown. if shutting_down(): - # Since no new work items can be added, it is safe to shutdown - # this thread if there are no pending work items. - if not pending_work_items and call_queue.qsize() == 0: - shutdown_worker() - return try: - # Start shutting down by telling a process it can exit. - call_queue.put_nowait(None) + # Since no new work items can be added, it is safe to shutdown + # this thread if there are no pending work items. + if not pending_work_items: + shutdown_worker() + return + else: + # Start shutting down by telling a process it can exit. + call_queue.put_nowait(None) except Full: # This is not a problem: we will eventually be woken up (in - # result_queue.get()) and be able to send a sentinel again, - # if necessary. + # result_queue.get()) and be able to send a sentinel again. pass executor = None |