Issue #12040: Expose a new attribute sentinel on instances of

:class:`multiprocessing.Process`.  Also, fix Process.join() to not use
polling anymore, when given a timeout.
This commit is contained in:
Antoine Pitrou 2011-06-06 19:35:31 +02:00
parent f068ab8304
commit 176f07dadf
6 changed files with 108 additions and 14 deletions

View file

@ -411,6 +411,20 @@ The :mod:`multiprocessing` package mostly replicates the API of the
See :ref:`multiprocessing-auth-keys`.
.. attribute:: sentinel
A numeric handle of a system object which will become "ready" when
the process ends.
On Windows, this is an OS handle usable with the ``WaitForSingleObject``
and ``WaitForMultipleObjects`` family of API calls. On Unix, this is
a file descriptor usable with primitives from the :mod:`select` module.
You can use this value if you want to wait on several events at once.
Otherwise calling :meth:`join()` is simpler.
.. versionadded:: 3.3
.. method:: terminate()
Terminate the process. On Unix this is done using the ``SIGTERM`` signal;