From: Ross Lagerwall Date: Sun, 8 Jan 2012 06:42:03 +0000 (+0200) Subject: Merge with 3.2 for #12364. X-Git-Tag: v3.3.0a1~459 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=69f39a53f62734d3e8dcb4bdcc217c4b3551d393;p=thirdparty%2FPython%2Fcpython.git Merge with 3.2 for #12364. --- 69f39a53f62734d3e8dcb4bdcc217c4b3551d393 diff --cc Lib/concurrent/futures/process.py index 0575146b220b,d3bbe2c5e68f..7f31ec2263ba --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@@ -266,21 -219,20 +266,18 @@@ def _queue_management_worker(executor_r # - The interpreter is shutting down OR # - The executor that owns this worker has been collected OR # - The executor that owns this worker has been shutdown. - if _shutdown or executor is None or executor._shutdown_thread: - # 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: - while nb_shutdown_processes < len(processes): - shutdown_one_process() - # If .join() is not called on the created processes then - # some multiprocessing.Queue methods may deadlock on Mac OS - # X. - for p in processes: - p.join() - call_queue.close() - return - del executor + if shutting_down(): + try: + # 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. + pass + executor = None _system_limits_checked = False _system_limited = None