Photon microGUI widgets library 0.6.0
stdex::thread Class Reference

Thread class. More...

#include <thread.hpp>

Public Member Functions

 thread () throw ()
 
 ~thread ()
 
void join ()
 
bool joinable () const throw ()
 
void detach ()
 
id get_id () const throw ()
 Return the thread ID of a thread object.
 
native_handle_type native_handle ()
 Get the native handle for this thread.
 

Static Public Member Functions

static unsigned hardware_concurrency () throw ()
 

Detailed Description

Thread class.

Constructor & Destructor Documentation

◆ thread()

stdex::thread::thread ( )
throw (
)
inline

Default constructor. Construct a thread object without an associated thread of execution (i.e. non-joinable).

◆ ~thread()

stdex::thread::~thread ( )

Destructor.

Note
If the thread is joinable upon destruction, std::terminate() will be called, which terminates the process. It is always wise to do join() before deleting a thread object.

Member Function Documentation

◆ detach()

void stdex::thread::detach ( )

Detach from the thread. After calling detach(), the thread object is no longer associated with a thread of execution (i.e. it is not joinable). The thread continues execution without the calling thread blocking, and when the thread ends execution, any owned resources are released.

◆ hardware_concurrency()

static unsigned stdex::thread::hardware_concurrency ( )
throw (
)
static

Determine the number of threads which can possibly execute concurrently. This function is useful for determining the optimal number of threads to use for a task.

Returns
The number of hardware thread contexts in the system.
Note
If this value is not defined, the function returns zero.

◆ join()

void stdex::thread::join ( )

Wait for the thread to finish (join execution flows). After calling join(), the thread object is no longer associated with a thread of execution (i.e. it is not joinable, and you may not join with it nor detach from it).

◆ joinable()

bool stdex::thread::joinable ( ) const
throw (
)

Check if the thread is joinable. A thread object is joinable if it has an associated thread of execution.


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