mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Fix issue 4660: spurious task_done errors in multiprocessing, remove doc note for from_address
This commit is contained in:
parent
175e0bf8ca
commit
8497efeb40
4 changed files with 20 additions and 8 deletions
|
@ -282,9 +282,22 @@ class JoinableQueue(Queue):
|
|||
Queue.__setstate__(self, state[:-2])
|
||||
self._cond, self._unfinished_tasks = state[-2:]
|
||||
|
||||
def put(self, item, block=True, timeout=None):
|
||||
Queue.put(self, item, block, timeout)
|
||||
self._unfinished_tasks.release()
|
||||
def put(self, obj, block=True, timeout=None):
|
||||
assert not self._closed
|
||||
if not self._sem.acquire(block, timeout):
|
||||
raise Full
|
||||
|
||||
self._notempty.acquire()
|
||||
self._cond.acquire()
|
||||
try:
|
||||
if self._thread is None:
|
||||
self._start_thread()
|
||||
self._buffer.append(obj)
|
||||
self._unfinished_tasks.release()
|
||||
self._notempty.notify()
|
||||
finally:
|
||||
self._cond.release()
|
||||
self._notempty.release()
|
||||
|
||||
def task_done(self):
|
||||
self._cond.acquire()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue