parent: return latch to wait() caller to allow graceful timeout
This commit is contained in:
parent
b0309b539c
commit
ff7fb00569
|
@ -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)
|
||||||
|
|
||||||
|
|
|
@ -806,6 +806,7 @@ class Context(mitogen.core.Context):
|
||||||
|
|
||||||
if wait:
|
if wait:
|
||||||
latch.get()
|
latch.get()
|
||||||
|
else:
|
||||||
return latch
|
return latch
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue