fix8  version 1.4.0
Open Source C++ FIX Framework
FIX8::f8_thread_cancellation_token Class Reference

Thread cancellation token. More...

#include <thread.hpp>

Public Types

enum  ThreadState { Unknown, Running, Stopping, Stopped }
 Thread state enumerations. More...
 

Public Member Functions

 f8_thread_cancellation_token ()
 ctor More...
 
bool stop_requested () const
 
void request_stop ()
 Tell the thread to stop. More...
 
 operator bool () const
 
bool operator! () const
 
int thread_state () const
 
void thread_state (ThreadState state)
 

Private Attributes

f8_atomic< int > _stop_requested
 
f8_atomic< int > _thread_state
 

Detailed Description

Thread cancellation token.

Definition at line 206 of file thread.hpp.

Member Enumeration Documentation

Constructor & Destructor Documentation

FIX8::f8_thread_cancellation_token::f8_thread_cancellation_token ( )
inline

ctor

Definition at line 212 of file thread.hpp.

Member Function Documentation

FIX8::f8_thread_cancellation_token::operator bool ( ) const
inline

check if a stop has been requested

Returns
true if stop requested

Definition at line 223 of file thread.hpp.

223 { return stop_requested(); }
bool FIX8::f8_thread_cancellation_token::operator! ( ) const
inline

check if a stop has been requested

Returns
false if stop requested

Definition at line 227 of file thread.hpp.

227 { return !stop_requested(); }
void FIX8::f8_thread_cancellation_token::request_stop ( )
inline

Tell the thread to stop.

Definition at line 219 of file thread.hpp.

Referenced by FIX8::Logger::stop().

bool FIX8::f8_thread_cancellation_token::stop_requested ( ) const
inline

check if a stop has been requested

Returns
true if stop requested

Definition at line 216 of file thread.hpp.

216 { return _stop_requested == 1; }
f8_atomic< int > _stop_requested
Definition: thread.hpp:208
int FIX8::f8_thread_cancellation_token::thread_state ( ) const
inline

Get the current thread state

Returns
thread state enumeration

Definition at line 234 of file thread.hpp.

234 { return _thread_state; }
f8_atomic< int > _thread_state
Definition: thread.hpp:208
void FIX8::f8_thread_cancellation_token::thread_state ( ThreadState  state)
inline

Set the thread state

Parameters
statestate to set to

Definition at line 238 of file thread.hpp.

238 { _thread_state = state; }
f8_atomic< int > _thread_state
Definition: thread.hpp:208

Member Data Documentation

f8_atomic<int> FIX8::f8_thread_cancellation_token::_stop_requested
private

Definition at line 208 of file thread.hpp.

f8_atomic<int> FIX8::f8_thread_cancellation_token::_thread_state
private

Definition at line 208 of file thread.hpp.


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