Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::InitiallyPausedThread Class Referencefinal

#include <InitiallyPausedThread.h>

Inheritance diagram for ph::InitiallyPausedThread:
ph::IMoveOnly

Public Member Functions

 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.
 
InitiallyPausedThreadoperator= (InitiallyPausedThread &&rhs)=default
 

Constructor & Destructor Documentation

◆ InitiallyPausedThread() [1/3]

ph::InitiallyPausedThread::InitiallyPausedThread ( )

An empty object that does not represent a thread.

◆ InitiallyPausedThread() [2/3]

ph::InitiallyPausedThread::InitiallyPausedThread ( InitiallyPausedThread && other)
inlinedefault

◆ 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
funcFunctor to be called by the thread. It is copied/moved by value and stored in the thread.
argsArguments 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.

Member Function Documentation

◆ 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
IllegalOperationExceptionIf any error occurred.

◆ operator=()

InitiallyPausedThread & ph::InitiallyPausedThread::operator= ( InitiallyPausedThread && rhs)
inlinedefault

◆ start()

void ph::InitiallyPausedThread::start ( )

Start the execution of the thread. This method synchronizes-with the start of the call to the functor.

Exceptions
IllegalOperationExceptionIf any error occurred.

The documentation for this class was generated from the following files: