docs: More getting started.

This commit is contained in:
David Wilson 2018-03-30 13:05:47 +05:45
parent 76ac49dbdc
commit 6958b8ff09
1 changed files with 18 additions and 0 deletions

View File

@ -247,6 +247,24 @@ without the need for writing asynchronous code::
print 'Reply from %s: %s' % (recv.context, data) print 'Reply from %s: %s' % (recv.context, data)
Running Code That May Hang
--------------------------
When executing code that may hang due to, for example, talking to network peers
that may become unavailable, it is desirable to be able to recover control in
the case a remote call has hung.
By specifying the `timeout` parameter to :meth:`Receiver.get` on the receiver
returned by `Context.call_async`, it becomes possible to wait for a function to
complete, but time out if its result does not become available.
When a context has become hung like this, it is still possible to gracefully
terminate it using the :meth:`Context.shutdown` method. This method sends a
shutdown message to the target process, where its IO multiplexer thread can
still process it independently of the hung function running on on the target's
main thread.
Recovering Mitogen Object References In Children Recovering Mitogen Object References In Children
------------------------------------------------ ------------------------------------------------