From 78cec8c0a3b171ca7ac1a179693850c514c549e5 Mon Sep 17 00:00:00 2001 From: "brian.quinlan" Date: Fri, 23 Oct 2009 06:41:10 +0000 Subject: Make the number of extra items in the multiprocessing queue configuration --- python2/futures/process.py | 4 +++- 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 -- cgit v1.2.1