ILLIXR: Illinois Extended Reality Testbed
|
An object that manages a std::thread; it joins and exits when the object gets destructed. More...
#include <managed_thread.hpp>
Public Types | |
enum class | state { nonstartable , startable , running , stopped } |
Possible states for a managed_thread. | |
Public Member Functions | |
managed_thread () noexcept=default | |
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. More... | |
~managed_thread () noexcept | |
Stops a thread, if necessary. | |
state | get_state () |
void | start () |
Moves a managed_thread from startable to running. | |
void | stop () |
Moves a managed_thread from running to stopped. | |
An object that manages a std::thread; it joins and exits when the object gets destructed.
|
inlineexplicitnoexcept |
Constructs a startable thread.
on_stop
is called once (if present) on_start
is called as the thread is joining body
is called in a tight loop