CIRCT 24.0.0git
Loading...
Searching...
No Matches
esi::cosim::FaultStash Class Reference

Cross-thread error channel for the IXWebSocket network thread. More...

#include <RpcWire.h>

Collaboration diagram for esi::cosim::FaultStash:

Public Member Functions

void record (std::exception_ptr ep) noexcept
 Stash the first exception we see (subsequent ones are dropped – the first is the most informative).
void check ()
 Consume and rethrow the stored fault on the caller's thread, if any.

Private Attributes

std::mutex mutex
std::exception_ptr fault

Detailed Description

Cross-thread error channel for the IXWebSocket network thread.

IXWebSocket invokes user callbacks from its internal network thread; any exception escaping that callback kills the process. Call sites catch and record() the first fault; the next public method on the owning RpcServer/RpcClient calls check(), which consumes the stash and rethrows on the user's thread.

Definition at line 73 of file RpcWire.h.

Member Function Documentation

◆ check()

void esi::cosim::FaultStash::check ( )
inline

Consume and rethrow the stored fault on the caller's thread, if any.

Definition at line 84 of file RpcWire.h.

References fault, and mutex.

◆ record()

void esi::cosim::FaultStash::record ( std::exception_ptr ep)
inlinenoexcept

Stash the first exception we see (subsequent ones are dropped – the first is the most informative).

Safe to call from any thread.

Definition at line 77 of file RpcWire.h.

References fault, and mutex.

Member Data Documentation

◆ fault

std::exception_ptr esi::cosim::FaultStash::fault
private

Definition at line 97 of file RpcWire.h.

Referenced by check(), and record().

◆ mutex

std::mutex esi::cosim::FaultStash::mutex
private

Definition at line 96 of file RpcWire.h.

Referenced by check(), and record().


The documentation for this class was generated from the following file: