hpx::supervision::init#

Defined in header hpx/supervision_dispatch.hpp.

See Public API for a list of names and headers that are part of the public HPX API.

See also:

hpx::shared_future<registry> hpx::supervision::init(hpx::chrono::steady_duration const &discovery_timeout = default_discovery_timeout)#

Performs one-shot, idempotent initialization of the supervision-dispatch runtime for this locality. On the first successful call, this function atomically transitions the internal lifecycle state from uninitialized to initializing, after incrementing the internal epoch, then owns the entire startup sequence: it creates a local registry for hpx::find_here(), publishes event::started for this locality before the registry’s symbol name is registered (so that no peer can discover and join a not-yet-started locality), registers that symbol name, and finally performs a single discover_and_join() pass to join every currently reachable peer registry. On success the state transitions to active; if any step throws, all partial state is rolled back and the lifecycle reverts to uninitialized so that a subsequent call can retry from scratch.

Calling init() while already active is a no-op that resolves immediately without repeating any side effect. Calling it while another call is still initializing attaches the caller to the in-flight operation’s outcome rather than racing it, so concurrent callers never create more than one registry. Calling it while finalizing is in progress is rejected; callers should wait for finalize() to complete before re-initializing.

Note

This function has no effect on any state that has not yet been created by a successful call - in particular, no symbol name is ever registered and no event is ever published unless this function (or a concurrent call it is attached to) actually runs the initialization sequence.

Parameters

discovery_timeout – The maximum duration to wait, across all discovery candidates combined, for peer registry symbol names to resolve during the discover_and_join() step (see discover_peers()).

Returns

A shared future that becomes ready, holding the registry owned by this init() cycle, once the supervision runtime has reached the active state, or that becomes exceptional if initialization fails.

registry hpx::supervision::init(hpx::launch::sync_policy policy, hpx::chrono::steady_duration const &discovery_timeout = default_discovery_timeout)#

Performs one-shot, idempotent initialization of the supervision-dispatch runtime for this locality, blocking the calling thread until the operation completes. This is the synchronous counterpart of init(hpx::chrono::steady_duration const&): it carries out the exact same lifecycle transition and startup sequence (registry creation, event::started publication, symbol name registration, and a single discover_and_join() pass), but waits for the resulting future to become ready (or exceptional) before returning, rather than handing the future back to the caller.

Note

As with the asynchronous overload, no symbol name is registered and no event is published unless this call (or a concurrent call it attaches to) actually performs the initialization sequence.

Parameters
  • policy – Tag selecting the blocking overload of init().

  • discovery_timeout – The maximum duration to wait, across all discovery candidates combined, for peer registry symbol names to resolve during the discover_and_join() step (see discover_peers()).

Throws

hpx::exception – if initialization could not complete (e.g. due to a concurrent finalize() still in progress). Calling this while already active is a no-op that returns immediately.

Returns

The registry owned by this init() cycle.