mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Issue #11815: Use a light-weight SimpleQueue for the result queue in concurrent.futures.ProcessPoolExecutor.
This commit is contained in:
parent
3fdd9b681d
commit
b7877f203d
2 changed files with 6 additions and 2 deletions
|
@ -49,6 +49,7 @@ import atexit
|
||||||
from concurrent.futures import _base
|
from concurrent.futures import _base
|
||||||
import queue
|
import queue
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
from multiprocessing.queues import SimpleQueue
|
||||||
import threading
|
import threading
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
|
@ -204,7 +205,7 @@ def _queue_manangement_worker(executor_reference,
|
||||||
work_ids_queue,
|
work_ids_queue,
|
||||||
call_queue)
|
call_queue)
|
||||||
|
|
||||||
result_item = result_queue.get(block=True)
|
result_item = result_queue.get()
|
||||||
if result_item is not None:
|
if result_item is not None:
|
||||||
work_item = pending_work_items[result_item.work_id]
|
work_item = pending_work_items[result_item.work_id]
|
||||||
del 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.
|
# because futures in the call queue cannot be cancelled.
|
||||||
self._call_queue = multiprocessing.Queue(self._max_workers +
|
self._call_queue = multiprocessing.Queue(self._max_workers +
|
||||||
EXTRA_QUEUED_CALLS)
|
EXTRA_QUEUED_CALLS)
|
||||||
self._result_queue = multiprocessing.Queue()
|
self._result_queue = SimpleQueue()
|
||||||
self._work_ids = queue.Queue()
|
self._work_ids = queue.Queue()
|
||||||
self._queue_management_thread = None
|
self._queue_management_thread = None
|
||||||
self._processes = set()
|
self._processes = set()
|
||||||
|
|
|
@ -103,6 +103,9 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #11815: Use a light-weight SimpleQueue for the result queue in
|
||||||
|
concurrent.futures.ProcessPoolExecutor.
|
||||||
|
|
||||||
- Issue #5162: Treat services like frozen executables to allow child spawning
|
- Issue #5162: Treat services like frozen executables to allow child spawning
|
||||||
from multiprocessing.forking on Windows.
|
from multiprocessing.forking on Windows.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue