hpx::supervision::invoke_fenced_action

hpx::supervision::invoke_fenced_action#

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:

template<typename Action, typename IdType, typename Epoch, typename ...Ts>
decltype(auto) hpx::supervision::invoke_fenced_action(Action act, IdType target, Epoch const epoch, Ts... ts)#

Remote dispatch point that performs the authoritative admission re-check and invokes the wrapped action.

This is the function body that actually runs as the action on the destination locality (the target’s own locality, reached via hpx::colocated in dispatch_work()). It is invoked by fenced_action once the action has been dispatched.

The admission check performed here runs on the same locality/thread that owns the target’s supervision_manager state, so there is no suspension point between this check and the actual invocation below. This is what closes the client-side/dispatch race: even if the client’s own (non-authoritative) check_admission() in dispatch_work() returned admitted, the target may have latched a terminal event for this epoch in the meantime, and this re-check will catch it.

This re-check is authoritative only because a joining registry (see components/supervision_dispatch/src/server/registry_server.cpp) dual-publishes lifecycle mirrors for a joined peer onto that peer’s own locality, in addition to the joining registry’s local copy: target must resolve to that same peer locality for this guarantee to hold. Dispatching target against an unrelated third locality - one that never received the dual-published mirror for this target - remains out of contract; the re-check performed there consults a supervision_manager state that was never seeded for target and so cannot detect fencing.

Template Parameters:
  • Action – The wrapped HPX action type to invoke on admission.

  • IdType – Type of the target identifier forwarded to act (this type is always hpx::id_type).

  • Epoch – Type of the fencing epoch value (this type is always std::uint64_t).

  • Ts – Types of the additional arguments forwarded to act.

Parameters:
  • act – The action instance to invoke once admission succeeds.

  • target – Identifier of the component instance being dispatched to; forwarded to act (the epoch is fencing metadata only and is not part of act's argument list).

  • epoch – The fencing epoch to check admission for.

  • ts – Additional arguments forwarded to act.

Throws:

hpx::exception – with hpx::error::target_fenced if the target has latched a terminal event for epoch since the client’s own admission check, in which case the wrapped action is not invoked.

Returns:

The result of invoking act, obtained via hpx::sync (run directly/locally, without an extra parcel hop, since this function already executes on the target’s locality).