parent: return latch to wait() caller to allow graceful timeout

This commit is contained in:
David Wilson 2018-04-29 10:11:13 +01:00
parent b0309b539c
commit ff7fb00569
2 changed files with 7 additions and 1 deletions

View File

@ -917,6 +917,11 @@ Context Class
:param bool wait: :param bool wait:
If :py:data:`True`, block the calling thread until the context has If :py:data:`True`, block the calling thread until the context has
completely terminated. completely terminated.
:returns:
If `wait` is :data:`False`, returns a :class:`mitogen.core.Latch`
whose :meth:`get() <mitogen.core.Latch.get>` method returns
:data:`None` when shutdown completes. The `timeout` parameter may
be used to implement graceful timeouts.
.. method:: call_async (fn, \*args, \*\*kwargs) .. method:: call_async (fn, \*args, \*\*kwargs)

View File

@ -806,6 +806,7 @@ class Context(mitogen.core.Context):
if wait: if wait:
latch.get() latch.get()
else:
return latch return latch