Defined in: <sintra/sintra.h>
Synopsis:
void init(
int argc,
const char* const* argv,
std::vector<Process_descriptor> branches = std::vector<Process_descriptor>());
template <typename... Args>
void init(int argc, const char* const* argv, Args&&... args);Description: Initialise the current process as a member of a Sintra swarm.
init records the program arguments, creates the per-process
Managed_process singleton, branches the requested child processes (when
called from the starter), and connects the local process to the coordinator.
After it returns successfully, the high-level facade (transceivers, RPC,
slots, barriers, lifecycle helpers) is usable.
argc,argv— the original program arguments frommain. Both must be passed unchanged. Sintra appends its own--swarm_id,--instance_id, and--coordinator_idarguments for children it spawns and for external process invitations.branches(vector overload) — the swarm topology declared by the starter. EachProcess_descriptorbecomes one spawned process; the index of the descriptor in the vector becomes the branch index of that process.Args&&... args(variadic overload) — descriptors and per-descriptor multiplicities forwarded throughmake_branches(...)to the vector overload. An integer in the pack is read as a multiplicity that applies to the next descriptor.
void. After successful return,process_index()returns the branch index of the current process.
sintra::init_error— when one or more child processes cannot be spawned or fail to reach the initialisation barrier. The exception'sfailures()andsuccessful_spawns()describe what happened, anddiagnostic_report()returns a formatted multi-line summary.std::runtime_error— when called twice in the same process without a matching teardown.- Other exceptions during managed-process startup propagate as the original exception type from the runtime.
- The current
main()is the entry point of a Sintra-managed process. - The starter process needs to declare the swarm topology by passing
Process_descriptorvalues directly, an existing branch vector built withmake_branches, or a mix of descriptors and per-descriptor multiplicities. - A spawned child process attaches to the existing swarm. The variadic forms remain valid in the child; branch arguments whose role is only meaningful in the starter are ignored.
- A manually launched process has received arguments from
External_process_invitation::sintra_args()and must claim that invitation before user-level Sintra work begins.
- Must be called exactly once per process before any other facade API.
- The starter process is the one that observes its branch index as
0. Each declared branch becomes a spawned process selected by that branch index. - A second
initcall without an interveningshutdown(),leave(), ordetail::finalize()throwsstd::runtime_error. - The variadic overload forwards through
make_branches(...)and reaches the vector-based overload.
- Call
initfrom the program's main thread before spawning user threads that depend on the Sintra runtime. - On Linux and macOS,
initignoresSIGPIPEand starts a new session viasetsid(). Sintra also installs handlers forSIGABRT,SIGFPE,SIGILL,SIGINT,SIGSEGV, andSIGTERM, chaining any pre-existing handlers where possible. Programs that need bespoke signal handling must install their handlers afterinitreturns.
initmay install debug-pause handlers that hold the process at exit when theSINTRA_DEBUG_PAUSE_ON_EXITbuild configuration is enabled. Calldisable_debug_pause_for_current_processfrom the current process to opt out.- The cache-line check is debug-only. In
Debugbuilds,initlogs a warning when the assumed cache-line size does not match the host's actual size; the check is suppressed inReleasebuilds.