diff options
author | brian.quinlan <devnull@localhost> | 2009-10-23 06:41:10 +0000 |
---|---|---|
committer | brian.quinlan <devnull@localhost> | 2009-10-23 06:41:10 +0000 |
commit | 78cec8c0a3b171ca7ac1a179693850c514c549e5 (patch) | |
tree | 8dd24ca01c118bb87b7bae646f83c4c6ef55d910 | |
parent | 5aab5b5c6cfdc3c520fced44218e55b795451712 (diff) | |
download | futures-78cec8c0a3b171ca7ac1a179693850c514c549e5.tar.gz |
Make the number of extra items in the multiprocessing queue configuration
-rw-r--r-- | python2/futures/process.py | 4 | ||||
-rw-r--r-- | python3/futures/process.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/python2/futures/process.py b/python2/futures/process.py index e4c3ad3..fdea346 100644 --- a/python2/futures/process.py +++ b/python2/futures/process.py @@ -17,6 +17,7 @@ import weakref _thread_references = set() _shutdown = False +EXTRA_QUEUED_CALLS = 1 def _python_exit(): global _shutdown @@ -144,7 +145,8 @@ class ProcessPoolExecutor(Executor): # Make the call queue slightly larger than the number of processes to # prevent the worker processes from starving but to make future.cancel() # responsive. - self._call_queue = multiprocessing.Queue(self._max_processes + 1) + self._call_queue = multiprocessing.Queue(self._max_processes + + EXTRA_QUEUED_CALLS) self._result_queue = multiprocessing.Queue() self._work_ids = Queue.Queue() self._queue_management_thread = None diff --git a/python3/futures/process.py b/python3/futures/process.py index 75ee83c..af6e6be 100644 --- a/python3/futures/process.py +++ b/python3/futures/process.py @@ -18,6 +18,7 @@ import weakref _thread_references = set() _shutdown = False +EXTRA_QUEUED_CALLS = 1 def _python_exit(): global _shutdown @@ -143,7 +144,8 @@ class ProcessPoolExecutor(Executor): # Make the call queue slightly larger than the number of processes to # prevent the worker processes from starving but to make future.cancel() # responsive. - self._call_queue = multiprocessing.Queue(self._max_processes + 1) + self._call_queue = multiprocessing.Queue(self._max_processes + + EXTRA_QUEUED_CALLS) self._result_queue = multiprocessing.Queue() self._work_ids = queue.Queue() self._queue_management_thread = None |