#include <InitiallyPausedThread.h>
|
| InitiallyPausedThread () |
| An empty object that does not represent a thread.
|
|
| InitiallyPausedThread (InitiallyPausedThread &&other)=default |
|
template<typename Func , typename... Args> |
| InitiallyPausedThread (Func &&func, Args &&... args) |
| Creates a thread with a function to execute. The function will not execute immediately. The thread is in paused state initially and the execution can be started by calling start().
|
|
| ~InitiallyPausedThread () |
|
void | start () |
| Start the execution of the thread. This method synchronizes-with the start of the call to the functor.
|
|
void | join () |
| Wait until the execution of the thread is finished. hasStarted() must be true when calling this method. The finish of the call to the functor synchronizes-with this method.
|
|
bool | hasStarted () const |
| Whether the thread has started executing the functor. The started state is visible to the body of the functor.
|
|
bool | hasJoined () const |
| Whether the thread has joined.
|
|
std::thread::id | getId () const |
| Get ID of the underlying thread.
|
|
InitiallyPausedThread & | operator= (InitiallyPausedThread &&rhs)=default |
|
◆ InitiallyPausedThread() [1/3]
ph::InitiallyPausedThread::InitiallyPausedThread |
( |
| ) |
|
An empty object that does not represent a thread.
◆ InitiallyPausedThread() [2/3]
◆ InitiallyPausedThread() [3/3]
template<typename Func , typename... Args>
ph::InitiallyPausedThread::InitiallyPausedThread |
( |
Func && | func, |
|
|
Args &&... | args ) |
|
inlineexplicit |
Creates a thread with a function to execute. The function will not execute immediately. The thread is in paused state initially and the execution can be started by calling start().
- Parameters
-
func | Functor to be called by the thread. It is copied/moved by value and stored in the thread. |
args | Arguments passed to the functor. They are copied/moved by value and stored in the thread. |
- Note
func
and args
are passed the same way as std::thread
, which means to pass a reference argument to the thread, it has to be wrapped (e.g., with std::ref
or std::cref
).
◆ ~InitiallyPausedThread()
ph::InitiallyPausedThread::~InitiallyPausedThread |
( |
| ) |
|
join() must be called before the thread destructs.
◆ getId()
std::thread::id ph::InitiallyPausedThread::getId |
( |
| ) |
const |
|
inline |
Get ID of the underlying thread.
- Returns
- Thread ID. Will be empty (
std::thread::id()
) if this class is default constructed.
◆ hasJoined()
bool ph::InitiallyPausedThread::hasJoined |
( |
| ) |
const |
|
inline |
Whether the thread has joined.
◆ hasStarted()
bool ph::InitiallyPausedThread::hasStarted |
( |
| ) |
const |
|
inline |
Whether the thread has started executing the functor. The started state is visible to the body of the functor.
◆ join()
void ph::InitiallyPausedThread::join |
( |
| ) |
|
Wait until the execution of the thread is finished. hasStarted() must be true when calling this method. The finish of the call to the functor synchronizes-with this method.
- Exceptions
-
IllegalOperationException | If any error occurred. |
◆ operator=()
◆ start()
void ph::InitiallyPausedThread::start |
( |
| ) |
|
Start the execution of the thread. This method synchronizes-with the start of the call to the functor.
- Exceptions
-
IllegalOperationException | If any error occurred. |
The documentation for this class was generated from the following files: