High-level thread wrapper.
More...
#include <thread.h>
|
| thread () |
| Construct empty thread.
|
|
template<typename Callback, typename... ARGS> |
| thread (Callback c, ARGS &&... args) |
| Construct and start thread with callback.
|
|
template<typename Callback, typename... ARGS> |
| thread (Callback c, bool will_join, ARGS &&... args) |
| Construct and start thread with callback and join policy.
|
|
| thread (pThread p_thread, bool will_join=true) |
| Construct from existing pThread.
|
|
| thread (const thread &)=delete |
|
thread & | operator= (const thread &)=delete |
|
| thread (thread &&other) noexcept |
| Move constructor.
|
|
| thread (thread &&other, bool will_join) noexcept |
| Move constructor with explicit join policy.
|
|
thread & | operator= (thread &&other) noexcept |
|
bool | joinable () const |
| Check if thread is joinable.
|
|
| operator bool () const |
| Check if thread is valid.
|
|
bool | operator! () const |
| Check if thread is not valid.
|
|
void | join () |
| Wait for thread to complete.
|
|
void | detach () |
| Detach thread (allow it to run independently)
|
|
| ~thread () |
| Destructor.
|
|
High-level thread wrapper.
Manages thread lifetime with automatic join/detach
◆ thread() [1/5]
template<typename Callback, typename ... ARGS>
original::thread::thread |
( |
Callback | c, |
|
|
ARGS &&... | args ) |
|
explicit |
Construct and start thread with callback.
- Template Parameters
-
Callback | Callback function type |
ARGS | Argument types for callback |
- Parameters
-
c | Callback function |
args | Arguments to forward to callback |
- Note
- Will automatically join on destruction
◆ thread() [2/5]
template<typename Callback, typename ... ARGS>
original::thread::thread |
( |
Callback | c, |
|
|
bool | will_join, |
|
|
ARGS &&... | args ) |
|
explicit |
Construct and start thread with callback and join policy.
- Template Parameters
-
Callback | Callback function type |
ARGS | Argument types for callback |
- Parameters
-
c | Callback function |
will_join | Whether to join on destruction |
args | Arguments to forward to callback |
◆ thread() [3/5]
original::thread::thread |
( |
pThread | p_thread, |
|
|
bool | will_join = true ) |
|
inlineexplicit |
Construct from existing pThread.
- Parameters
-
p_thread | Thread to wrap |
will_join | Whether to join on destruction |
◆ thread() [4/5]
original::thread::thread |
( |
thread && | other | ) |
|
|
inlinenoexcept |
Move constructor.
- Parameters
-
- Note
- Defaults to join policy of source thread
◆ thread() [5/5]
original::thread::thread |
( |
thread && | other, |
|
|
bool | will_join ) |
|
inlinenoexcept |
Move constructor with explicit join policy.
- Parameters
-
other | Thread to move from |
will_join | Override join policy |
◆ ~thread()
original::thread::~thread |
( |
| ) |
|
|
inline |
Destructor.
- Note
- Automatically joins or detaches based on will_join policy
◆ detach()
void original::thread::detach |
( |
| ) |
|
|
inline |
Detach thread (allow it to run independently)
- Exceptions
-
◆ join()
void original::thread::join |
( |
| ) |
|
|
inline |
Wait for thread to complete.
- Exceptions
-
◆ joinable()
bool original::thread::joinable |
( |
| ) |
const |
|
nodiscard |
Check if thread is joinable.
- Returns
- true if thread is joinable
◆ operator bool()
original::thread::operator bool |
( |
| ) |
const |
|
explicit |
Check if thread is valid.
- Returns
- true if thread is valid
◆ operator!()
bool original::thread::operator! |
( |
| ) |
const |
Check if thread is not valid.
- Returns
- true if thread is not valid
The documentation for this class was generated from the following file: