diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-12 15:58:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-04-12 15:58:11 (GMT) |
commit | b7877f203d66ed693f7dca327963a8ce65c75e03 (patch) | |
tree | a8c37ae91d5a43853e6b169380e983f5896da82b /Lib/concurrent | |
parent | 3fdd9b681de6bee616deb98b538370720a39c284 (diff) | |
download | cpython-b7877f203d66ed693f7dca327963a8ce65c75e03.zip cpython-b7877f203d66ed693f7dca327963a8ce65c75e03.tar.gz cpython-b7877f203d66ed693f7dca327963a8ce65c75e03.tar.bz2 |
Issue #11815: Use a light-weight SimpleQueue for the result queue in concurrent.futures.ProcessPoolExecutor.
Diffstat (limited to 'Lib/concurrent')
-rw-r--r-- | Lib/concurrent/futures/process.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/concurrent/futures/process.py b/Lib/concurrent/futures/process.py index 36cd411..1f4b242 100644 --- a/Lib/concurrent/futures/process.py +++ b/Lib/concurrent/futures/process.py @@ -49,6 +49,7 @@ import atexit from concurrent.futures import _base import queue import multiprocessing +from multiprocessing.queues import SimpleQueue import threading import weakref @@ -204,7 +205,7 @@ def _queue_manangement_worker(executor_reference, work_ids_queue, call_queue) - result_item = result_queue.get(block=True) + result_item = result_queue.get() if result_item is not None: work_item = pending_work_items[result_item.work_id] del pending_work_items[result_item.work_id] @@ -284,7 +285,7 @@ class ProcessPoolExecutor(_base.Executor): # because futures in the call queue cannot be cancelled. self._call_queue = multiprocessing.Queue(self._max_workers + EXTRA_QUEUED_CALLS) - self._result_queue = multiprocessing.Queue() + self._result_queue = SimpleQueue() self._work_ids = queue.Queue() self._queue_management_thread = None self._processes = set() |