aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ipc.h
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-12-05 15:57:12 -0500
committerRussell Yanofsky <russ@yanofsky.org>2021-04-23 03:02:50 -0500
commit7d76cf667eff512043a28d4407cc89f58796c42b (patch)
tree184c1ac31cbe53a239090dcd4598077a7394e02f /src/interfaces/ipc.h
parentddf7ecc8dfc64cf121099fb047e1ac871de94f4c (diff)
multiprocess: Add comments and documentation
Diffstat (limited to 'src/interfaces/ipc.h')
-rw-r--r--src/interfaces/ipc.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/interfaces/ipc.h b/src/interfaces/ipc.h
index 65df575da8..e9e6c78053 100644
--- a/src/interfaces/ipc.h
+++ b/src/interfaces/ipc.h
@@ -13,7 +13,30 @@ namespace interfaces {
class Init;
//! Interface providing access to interprocess-communication (IPC)
-//! functionality.
+//! functionality. The IPC implementation is responsible for establishing
+//! connections between a controlling process and a process being controlled.
+//! When a connection is established, the process being controlled returns an
+//! interfaces::Init pointer to the controlling process, which the controlling
+//! process can use to get access to other interfaces and functionality.
+//!
+//! When spawning a new process, the steps are:
+//!
+//! 1. The controlling process calls interfaces::Ipc::spawnProcess(), which
+//! calls ipc::Process::spawn(), which spawns a new process and returns a
+//! socketpair file descriptor for communicating with it.
+//! interfaces::Ipc::spawnProcess() then calls ipc::Protocol::connect()
+//! passing the socketpair descriptor, which returns a local proxy
+//! interfaces::Init implementation calling remote interfaces::Init methods.
+//! 2. The spawned process calls interfaces::Ipc::startSpawnProcess(), which
+//! calls ipc::Process::checkSpawned() to read command line arguments and
+//! determine whether it is a spawned process and what socketpair file
+//! descriptor it should use. It then calls ipc::Protocol::serve() to handle
+//! incoming requests from the socketpair and invoke interfaces::Init
+//! interface methods, and exit when the socket is closed.
+//! 3. The controlling process calls local proxy interfaces::Init object methods
+//! to make other proxy objects calling other remote interfaces. It can also
+//! destroy the initial interfaces::Init object to close the connection and
+//! shut down the spawned process.
class Ipc
{
public: