Thread class. More...
#include <tinythread.h>
Classes | |
class | id |
Thread ID. More... | |
Public Member Functions | |
thread () | |
Default constructor. | |
thread (void(*aFunction)(void *), void *aArg) | |
Thread starting constructor. | |
~thread () | |
Destructor. | |
void | join () |
Wait for the thread to finish (join execution flows). | |
bool | joinable () const |
Check if the thread is joinable. | |
id | get_id () const |
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 () |
Determine the number of threads which can possibly execute concurrently. |
Thread class.
thread | ( | ) | [inline] |
Default constructor.
Construct a thread
object without an associated thread of execution (i.e. non-joinable).
thread | ( | void(*)(void *) | aFunction, | |
void * | aArg | |||
) |
Thread starting constructor.
Construct a thread
object with a new thread of execution.
[in] | aFunction | A function pointer to a function of type: void fun(void * arg) |
[in] | aArg | Argument to the thread function. |
~thread | ( | ) |
Destructor.
std::terminate()
will be called, which terminates the process. It is always wise to do join()
before deleting a thread object. static unsigned hardware_concurrency | ( | ) | [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.
bool joinable | ( | ) | const |
Check if the thread is joinable.
A thread object is joinable if it has an associated thread of execution.
native_handle_type native_handle | ( | ) | [inline] |
Get the native handle for this thread.
HANDLE
, and under POSIX systems, this is a pthread_t
.