algotradelib 0.0.0.9000
C++ header-only library for algorithmic trading
Loading...
Searching...
No Matches
algotradelib::runner::StopSource Class Reference

A stop request the loop polls; safe to set from a signal handler. More...

#include <algotradelib/src/runner/stop.hpp>

Public Member Functions

void request (StopIntent intent) noexcept
 Requests a stop, keeping whichever of this and an earlier intent is stronger.
bool requested () const noexcept
 Tests whether a stop has been requested.
std::optional< StopIntent > intent () const noexcept
 Returns the requested intent.
void clear () noexcept
 Clears the request (for tests, or a supervisor deliberately resuming); the loop never does.

Detailed Description

A stop request the loop polls; safe to set from a signal handler.

Two requests keep the stronger intent: a FLATTEN followed by a routine SIGTERM stays a FLATTEN.

Definition at line 158 of file stop.hpp.

Member Function Documentation

◆ clear()

void algotradelib::runner::StopSource::clear ( )
inlinenoexcept

Clears the request (for tests, or a supervisor deliberately resuming); the loop never does.

Definition at line 200 of file stop.hpp.

◆ intent()

std::optional< StopIntent > algotradelib::runner::StopSource::intent ( ) const
inlinenoexcept

Returns the requested intent.

Returns
The intent, or std::nullopt if no stop has been requested.

Definition at line 191 of file stop.hpp.

Referenced by request().

◆ request()

void algotradelib::runner::StopSource::request ( StopIntent intent)
inlinenoexcept

Requests a stop, keeping whichever of this and an earlier intent is stronger.

Async-signal-safe (a lock-free atomic compare-exchange).

Parameters
intentThe intent.

Definition at line 167 of file stop.hpp.

◆ requested()

bool algotradelib::runner::StopSource::requested ( ) const
inlinenoexcept

Tests whether a stop has been requested.

Returns
true once request has been called (until clear).

Definition at line 183 of file stop.hpp.


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