|
CoreComponents 4.0.0
A Modern C++ Toolkit
|
Single thread of execution. More...
#include <cc/Thread>
Public Member Functions | |
| Thread ()=default | |
| Create a null thread. | |
| Thread (Function< void()> &&f, long stackSize=-1) | |
| Create a new thread. | |
| void | start () |
| Start the thread. | |
| bool | started () const |
| Tell if the thread has been started. | |
| void | wait () |
| Wait for the thread to finish its execution. | |
| void | kill (Signal signal) |
| Send a signal to the thread. | |
| bool | isRunning () const |
| Check if the thread is still running. | |
| void | setName (const char *name) |
| Set the thread's name for debugging | |
| operator bool () const | |
| Check if this is a non-null thread. | |
Public Member Functions inherited from Object | |
| Object ()=default | |
| Create a null object. | |
| operator bool () const | |
| Check if this is a non-null object. | |
| bool | isNull () const |
| Check if this is a null object. | |
| int | useCount () const |
| Reference count. | |
| template<class T > | |
| bool | is () const |
| Check if this object is of type T. | |
| template<class T > | |
| T | as () const |
| Cast this object to type T. | |
| bool | isWeak () const |
| Check if the underlying object reference is weak. | |
| bool | operator== (const Object &other) const |
| Equality operator. | |
| std::strong_ordering | operator<=> (const Object &other) const |
| Ordering operator. | |
Static Public Member Functions | |
| static uint64_t | id () |
| Get an unique ID indentifying the calling thread. | |
| static void | sleep (double duration) |
| Suspend execution of the current thread for duration seconds. | |
| static void | sleepUntil (double time) |
| Suspend execution of the current thread until time. | |
| static void | blockSignals (const SignalSet &set) |
| Block signals of given set. | |
| static void | unblockSignals (const SignalSet &set) |
| Unblock signals of given set. | |
| static SignalSet | signalMask () |
| Query the currently active signal mask. | |
| static int | getMinPriority (SchedulingPolicy policy) |
| Get minimum priority level supported by the sytem under giving scheduling policy. | |
| static int | getMaxPriority (SchedulingPolicy policy) |
| Get maximum priority level supported by the sytem under giving scheduling policy. | |
| static void | setSchedulingPolicy (SchedulingPolicy policy, int priority=0) |
| Set scheduling policy of the calling thread | |
Additional Inherited Members | |
Public Types inherited from Object | |
| using | NullAccess = cc::NullAccess |
| Error thrown when trying to access a null object. | |
| using | VirginityTestFailed = cc::VirginityTestFailed |
| Error thrown when trying to initialize an object with a non-virgin state. | |
Protected Member Functions inherited from Object | |
| template<class T > | |
| T | weak () const |
| template<class T > | |
| void | initOnce () |
| Create the object state when called the first time. | |
| template<class T > | |
| void | initOncePerThread () |
| Create a distinct object state for each thread when called the first time in that thread. | |
| Object (State *newState) | |
| Initialize object with newState. | |
| Object (State *state, Alias) | |
| Object (State *state, Weak) | |
| Object & | operator= (std::nullptr_t) |
Static Protected Member Functions inherited from Object | |
| template<class T > | |
| static T | alias (const State *state) |
| Create an alias object for the given state. | |
| template<class T > | |
| static T | weak (const State *state) |
Protected Attributes inherited from Object | |
| Handle< State > | me |
| Internal object state | |
Single thread of execution.
|
default |
Create a null thread.
Create a new thread.
| f | Entry point for thread execution |
| stackSize | Size of stack to allocate for the new thread (-1 for system default) |
| void start | ( | ) |
Start the thread.
| bool started | ( | ) | const |
Tell if the thread has been started.
| void wait | ( | ) |
Wait for the thread to finish its execution.
| void kill | ( | Signal | signal | ) |
Send a signal to the thread.
| bool isRunning | ( | ) | const |
Check if the thread is still running.
| void setName | ( | const char * | name | ) |
Set the thread's name for debugging
|
explicit |
Check if this is a non-null thread.
|
static |
Get an unique ID indentifying the calling thread.
|
static |
Suspend execution of the current thread for duration seconds.
|
static |
Suspend execution of the current thread until time.
|
static |
Block signals of given set.
|
static |
Unblock signals of given set.
|
static |
Query the currently active signal mask.
|
static |
Get minimum priority level supported by the sytem under giving scheduling policy.
|
static |
Get maximum priority level supported by the sytem under giving scheduling policy.
|
static |
Set scheduling policy of the calling thread