IPDL/Getting started: Difference between revisions

Jump to navigation Jump to search
Clarified the behaviour of blocking actors
(Clarified the number of actors involved in a communication via a protocol)
(Clarified the behaviour of blocking actors)
Line 202: Line 202:
# Wait until the child acknowledges that it received the message.  We call this '''synchronous''' semantics, as the parent blocks until the child receives the message and sends back a reply.
# Wait until the child acknowledges that it received the message.  We call this '''synchronous''' semantics, as the parent blocks until the child receives the message and sends back a reply.
# The third option is more complicated and will be introduced below, after another example.
# The third option is more complicated and will be introduced below, after another example.
Note that when a child actor blocks after sending a synchronous message, it is only that single child actor that is blocked, and not all child actors using the same protocol.  Similarly, when a parent actor  blocks after sending a synchronous message, it is only that one parent actor that is blocked, and not all parent actors using the same protocol.


In the Plugin protocol example above, we might want the Init() message to be synchronous.  It may not make sense for the browser to continue executing until it knows whether the plugin was successfully initialized.  (We will discuss which semantics, asynchronous or synchronous, is preferred in a later section.)  So for this particular case, let's extend the Plugin protocol's Init() message to be synchronous and return an error code: 0 if the plugin was initialized successfully, non-zero if not.  Here's a first attempt at that
In the Plugin protocol example above, we might want the Init() message to be synchronous.  It may not make sense for the browser to continue executing until it knows whether the plugin was successfully initialized.  (We will discuss which semantics, asynchronous or synchronous, is preferred in a later section.)  So for this particular case, let's extend the Plugin protocol's Init() message to be synchronous and return an error code: 0 if the plugin was initialized successfully, non-zero if not.  Here's a first attempt at that
31

edits

Navigation menu