![]() |
CommRaT 2.0.0
C++20 Real-Time Messaging Framework
|
Thread wrapper with realtime support. More...
#include <commrat/platform/threading.hpp>
Public Member Functions | |
| Thread ()=default | |
| Default constructor - no thread running. | |
| template<typename Func > | |
| Thread (const ThreadConfig &config, Func &&func) | |
| Create and start thread with function. | |
| Thread (const ThreadConfig &config) | |
| Create thread without starting (call start() later) | |
| ~Thread () | |
| Destructor - joins if joinable. | |
| Thread (const Thread &)=delete | |
| Thread & | operator= (const Thread &)=delete |
| Thread (Thread &&)=default | |
| Thread & | operator= (Thread &&)=default |
| template<typename Func > | |
| void | start (Func &&func) |
| Start thread with function (if not already started) | |
| void | join () |
| Join thread (wait for completion) | |
| void | detach () |
| Detach thread. | |
| bool | joinable () const noexcept |
| Check if thread is joinable. | |
| std::thread::native_handle_type | native_handle () |
| Get native thread handle. | |
| std::thread::id | get_id () const noexcept |
| Get thread ID. | |
| const ThreadConfig & | config () const noexcept |
| Get thread configuration. | |
Thread wrapper with realtime support.
Abstraction over std::thread with additional features:
Usage: Thread worker(config, []{ do_work(); }); worker.join();
Definition at line 76 of file threading.hpp.
|
default |
Default constructor - no thread running.
|
inline |
Create and start thread with function.
| config | Thread configuration |
| func | Function to execute |
Definition at line 90 of file threading.hpp.
|
inlineexplicit |
Create thread without starting (call start() later)
Definition at line 100 of file threading.hpp.
|
inline |
Destructor - joins if joinable.
Definition at line 107 of file threading.hpp.
|
delete |
|
default |
|
inlinenoexcept |
Get thread configuration.
Definition at line 174 of file threading.hpp.
|
inline |
Detach thread.
Definition at line 144 of file threading.hpp.
|
inlinenoexcept |
Get thread ID.
Definition at line 167 of file threading.hpp.
|
inline |
Join thread (wait for completion)
Definition at line 135 of file threading.hpp.
|
inlinenoexcept |
Check if thread is joinable.
Definition at line 153 of file threading.hpp.
|
inline |
Get native thread handle.
Definition at line 160 of file threading.hpp.
|
inline |
Start thread with function (if not already started)
Definition at line 123 of file threading.hpp.