Class ILLIXR::managed_thread
ClassList > ILLIXR > managed_thread
An object that manages a std::thread; it joins and exits when the object gets destructed.
#include <managed_thread.hpp>
Public Types
Type | Name |
---|---|
enum | state Possible states for a managed_thread . |
Public Functions
Type | Name |
---|---|
state | get_state () |
managed_thread () noexcept Constructs a non-startable thread. |
|
managed_thread (std::function< void()> body, std::function< void()> on_start=std::function< void()>{}, std::function< void()> on_stop=std::function< void()>{}) noexcept Constructs a startable thread. |
|
void | start () Moves a managed_thread from startable to running. |
void | stop () Moves a managed_thread from running to stopped. |
~managed_thread () noexcept Stops a thread, if necessary. |
Public Types Documentation
enum state
Possible states for a managed_thread .
enum ILLIXR::managed_thread::state {
nonstartable,
startable,
running,
stopped
};
Public Functions Documentation
function get_state
inline state ILLIXR::managed_thread::get_state ()
function managed_thread [1/2]
Constructs a non-startable thread.
ILLIXR::managed_thread::managed_thread () noexcept
function managed_thread [2/2]
Constructs a startable thread.
inline explicit ILLIXR::managed_thread::managed_thread (
std::function< void()> body,
std::function< void()> on_start=std::function< void()>{},
std::function< void()> on_stop=std::function< void()>{}
) noexcept
on_stop
is called once (if present) on_start
is called as the thread is joining body
is called in a tight loop
function start
Moves a managed_thread from startable to running.
inline void ILLIXR::managed_thread::start ()
function stop
Moves a managed_thread from running to stopped.
inline void ILLIXR::managed_thread::stop ()
function ~managed_thread
Stops a thread, if necessary.
inline ILLIXR::managed_thread::~managed_thread () noexcept
The documentation for this class was generated from the following file /home/friedel/devel/ILLIXR/include/illixr/managed_thread.hpp