thread class.
More...
#include <thread.hpp>
|
| | Thread () noexcept=default |
| | default constructor.
|
| |
| template<class Function , class... Args> |
| | Thread (Function &&func, Args &&... args) |
| | creates a new thread object associated with a thread of execution.
|
| |
| | Thread (const Thread &other)=delete |
| | copy constructor.
|
| |
| Thread & | operator= (const Thread &other)=delete |
| | copy assignment.
|
| |
| | Thread (Thread &&other) noexcept |
| | move constructor.
|
| |
| Thread & | operator= (Thread &&other) noexcept |
| | move assignment.
|
| |
| | ~Thread () |
| | destroys the thread object.
|
| |
| bool | joinable () const noexcept |
| | check if thread is joinable.
|
| |
| bool | running () const noexcept |
| | check if the thread is running.
|
| |
| void | join () |
| | block the current thread until the running thread finishes its execution.
|
| |
| bool | tryJoin () |
| | performs a nonblocking join on the running thread.
|
| |
| void | cancel () |
| | cancel the running thread if any.
|
| |
| void | swap (Thread &other) |
| | swap underlying handles of two thread objects.
|
| |
◆ Thread() [1/4]
◆ Thread() [2/4]
template<class Function , class... Args>
| join::Thread::Thread |
( |
Function && | func, |
|
|
Args &&... | args ) |
|
inlineexplicit |
creates a new thread object associated with a thread of execution.
- Parameters
-
| func | callable object to execute in the new thread. |
| args... | arguments to pass to the new function. |
◆ Thread() [3/4]
| join::Thread::Thread |
( |
const Thread & | other | ) |
|
|
delete |
copy constructor.
- Parameters
-
| other | other object to copy. |
◆ Thread() [4/4]
| Thread::Thread |
( |
Thread && | other | ) |
|
|
noexcept |
move constructor.
- Parameters
-
| other | other object to move. |
◆ ~Thread()
destroys the thread object.
◆ cancel()
cancel the running thread if any.
◆ join()
block the current thread until the running thread finishes its execution.
◆ joinable()
| bool Thread::joinable |
( |
| ) |
const |
|
noexcept |
check if thread is joinable.
- Returns
- true if joinable.
◆ operator=() [1/2]
copy assignment.
- Parameters
-
| other | other object to copy. |
- Returns
- a reference to the current object.
◆ operator=() [2/2]
move assignment.
- Parameters
-
| other | other object to move. |
- Returns
- a reference to the current object.
◆ running()
| bool Thread::running |
( |
| ) |
const |
|
noexcept |
check if the thread is running.
- Returns
- true if running, false otherwise.
◆ swap()
| void Thread::swap |
( |
Thread & | other | ) |
|
swap underlying handles of two thread objects.
- Parameters
-
| other | the thread to swap with. |
◆ tryJoin()
performs a nonblocking join on the running thread.
- Returns
- true if thread was joined, false if running thread didn't finished its execution.
The documentation for this class was generated from the following files: