summaryrefslogtreecommitdiffstats
path: root/Lib/multiprocessing
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-04-27 16:11:10 (GMT)
committerGitHub <noreply@github.com>2020-04-27 16:11:10 (GMT)
commit9adccc1384568f4d46e37f698cb3e3a4f6ca0252 (patch)
treef12424600659c0171b2f70f6ab97060c9a31b977 /Lib/multiprocessing
parentc5c42815ecb560bbf34db99b0e15fe9b604be889 (diff)
downloadcpython-9adccc1384568f4d46e37f698cb3e3a4f6ca0252.zip
cpython-9adccc1384568f4d46e37f698cb3e3a4f6ca0252.tar.gz
cpython-9adccc1384568f4d46e37f698cb3e3a4f6ca0252.tar.bz2
bpo-30966: Add multiprocessing.SimpleQueue.close() (GH-19735)
Add a new close() method to multiprocessing.SimpleQueue to explicitly close the queue. Automerge-Triggered-By: @pitrou
Diffstat (limited to 'Lib/multiprocessing')
-rw-r--r--Lib/multiprocessing/queues.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index c0a284d..a290181 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -346,6 +346,10 @@ class SimpleQueue(object):
else:
self._wlock = ctx.Lock()
+ def close(self):
+ self._reader.close()
+ self._writer.close()
+
def empty(self):
return not self._poll()