Fix bpo-30596: Add close() method to multiprocessing.Process (#2010)
* Fix bpo-30596: Add close() method to multiprocessing.Process
* Raise ValueError if close() is called before the Process is finished running
* Add docs
* Add NEWS blurb
diff --git a/Doc/library/multiprocessing.rst b/Doc/library/multiprocessing.rst
index 6b4a8cb..5265639 100644
--- a/Doc/library/multiprocessing.rst
+++ b/Doc/library/multiprocessing.rst
@@ -598,6 +598,16 @@
acquired a lock or semaphore etc. then terminating it is liable to
cause other processes to deadlock.
+ .. method:: close()
+
+ Close the :class:`Process` object, releasing all resources associated
+ with it. :exc:`ValueError` is raised if the underlying process
+ is still running. Once :meth:`close` returns successfully, most
+ other methods and attributes of the :class:`Process` object will
+ raise :exc:`ValueError`.
+
+ .. versionadded:: 3.7
+
Note that the :meth:`start`, :meth:`join`, :meth:`is_alive`,
:meth:`terminate` and :attr:`exitcode` methods should only be called by
the process that created the process object.