10 | @@ -11,6 +11,16 @@ If the wrapped C++ object inherits from an abstract base class declaring virtual
11 |
12 | There is also optional support for thread mapping, so each thread making interprocess calls can have a dedicated thread processing requests from it, and callbacks from processing threads are executed on corresponding request threads (so recursive mutexes and thread names function as expected in callbacks).
13 |
14 | +Libmultiprocess acts as a pure wrapper or layer over the underlying protocol. Clients and servers written in other languages, but using a shared capnproto schema can communicate with interprocess counterparties using libmultiprocess without having to use libmultiprocess themselves or having to know about the implementation details of libmultiprocess.
15 | +
16 | +### Internals
17 | +
18 | +The `ProxyClient` and `ProxyServer` generated classes are not directly exposed to the user, as described in [usage.md](usage.md). Instead, they wrap c++ interfaces and appear to the user as pointers to an interface. They are first instantiated when calling `ConnectStream` and `ServeStream` respectively for creating the `InitInterface`. These methods setup a `Connection` through a socket and wrap a `capnp::RpcSystem` configured for client and server mode respectively. Once more interfaces are instantiated from the `InitInterface`, they communicate over the same connection. Both `ConnectStream` and `ServerStream` also require an instantiation of the `EventLoop`. The `EventLoop` owns pending requests, notifies on request dispatch, allows clients from multiple threads to make synchronous calls, and handles some cleanup routines on exit. It must be run in a separate thread to allow calls being issued from multiple distinct threads.
In commit "doc: Add internal design section" (86415b456bb3307afae406c2b1b5cbc5d0c143b3)
This looks good as is, but few things come to mind reading this:
"These methods setup a Connection" could be clearer since technically there are 2 Connection objects for each connection (ConnectStream creates one when it is called on the connecting side, and ServeStream creates one each time there is an incoming connection on the side receiving connections). Would maybe change to "These methods establish connections, internally creating Connection objects, with each Connection wrapping a capnp::RpcSystem
May clarify "Once more interfaces are instantiated from the InitInterface" as "The InitInterface interface will typically have methods which return other interfaces, giving the connecting process the ability to call other functions in the serving process. Interfaces can also have methods accepting other interfaces as parameters, giving serving processes ability to call back and invoke functions in connecting processes. Creating new interfaces does not create new connections, and typically many interface objects will share the same connection."
Would maybe change "It must be run in a separate thread to allow calls..." to "It must run in a separate thread so it is always active and can process incoming requests from local clients and remote connections."