diff options
author | Victor Stinner <vstinner@python.org> | 2020-04-27 16:11:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-27 16:11:10 (GMT) |
commit | 9adccc1384568f4d46e37f698cb3e3a4f6ca0252 (patch) | |
tree | f12424600659c0171b2f70f6ab97060c9a31b977 /Doc | |
parent | c5c42815ecb560bbf34db99b0e15fe9b604be889 (diff) | |
download | cpython-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 'Doc')
-rw-r--r-- | Doc/library/multiprocessing.rst | 10 | ||||
-rw-r--r-- | Doc/whatsnew/3.9.rst | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst index ec9521f..50b9003 100644 --- a/Doc/library/multiprocessing.rst +++ b/Doc/library/multiprocessing.rst @@ -878,6 +878,16 @@ For an example of the usage of queues for interprocess communication see It is a simplified :class:`Queue` type, very close to a locked :class:`Pipe`. + .. method:: close() + + Close the queue: release internal resources. + + A queue must not be used anymore after it is closed. For example, + :meth:`get`, :meth:`put` and :meth:`empty` methods must no longer be + called. + + .. versionadded:: 3.9 + .. method:: empty() Return ``True`` if the queue is empty, ``False`` otherwise. diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 0b15ec7..13cd09b 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -376,6 +376,14 @@ nntplib if the given timeout for their constructor is zero to prevent the creation of a non-blocking socket. (Contributed by Dong-hee Na in :issue:`39259`.) +multiprocessing +--------------- + +The :class:`multiprocessing.SimpleQueue` class has a new +:meth:`~multiprocessing.SimpleQueue.close` method to explicitly close the +queue. +(Contributed by Victor Stinner in :issue:`30966`.) + os -- |