CIRCT 23.0.0git
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
esi::cosim::FaultStash Class Reference

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

#include <RpcWire.h>

Collaboration diagram for esi::cosim::FaultStash:
Collaboration graph
[legend]

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 69 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 80 of file RpcWire.h.

References fault, and mutex.

Referenced by esi::cosim::RpcServer::Impl::registerReadPort(), esi::cosim::RpcServer::Impl::registerWritePort(), esi::cosim::RpcServer::Impl::setManifest(), and esi::cosim::RpcServer::Impl::stop().

◆ 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 73 of file RpcWire.h.

References fault, and mutex.

Referenced by esi::cosim::RpcServer::Impl::handleControlFrame(), and esi::cosim::RpcServer::Impl::onClientMessage().

Member Data Documentation

◆ fault

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

Definition at line 93 of file RpcWire.h.

Referenced by check(), and record().

◆ mutex

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

Definition at line 92 of file RpcWire.h.

Referenced by check(), and record().


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