IPDL/Getting started: Difference between revisions

Jump to navigation Jump to search
Line 264: Line 264:


=== Preferred semantics ===
=== Preferred semantics ===
Use '''async''' semantics whenever possible.  Asynchronous messaging in C++ has a bad rap because of the complexity and verbosity of implementing asynchronous "protocols" in C++ with event loops and massive "switch" statements.  IPDL is specifically designed to make this easier and more concise.
Blocking on replies to messages is discouraged.  If you absolutely need to block on a reply, use '''sync''' semantics ''very carefully''.  It is possible to get into trouble with careless uses of synchronous messages; while IPDL can (or will eventually) check and/or guarantee that your code does not deadlock, it is easy to cause nasty performance problems by blocking.
Please don't use RPC semantics.  RPC inherits (nearly) all the problems of sync messages, while adding more of its own.  Every time your code makes an RPC call, it must ensure that its state is "consistent" enough to handle every re-entrant (nested) call allowed by the IPDL state machine.  This is hard to get right.  (Why was RPC semantics added?  Basically for NPAPI plugins, for which we can't change any existing plugin code.)
Confirmed users
699

edits

Navigation menu