Single thread of execution.
More...
#include <cc/Thread>
|
| | 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.
|
| |
| | 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.
|
| |
| 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.
|
| |
| long | useCount () const |
| | Reference count.
|
| |
|
|
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) |
| |
| 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) |
| |
| Handle< State > | me |
| | Internal object state
|
| |
Single thread of execution.
- See also
- System::concurrency()
- Todo
- simplify to autostart and remove start()/started()
◆ Thread() [1/2]
◆ Thread() [2/2]
Create a new thread.
- Parameters
-
| f | Entry point for thread execution |
| stackSize | Size of stack to allocate for the new thread (-1 for system default) |
◆ start()
◆ started()
Tell if the thread has been started.
- Note
- It is safe to invoke this method on a null thread, in which case it returns false.
◆ wait()
Wait for the thread to finish its execution.
◆ kill()
Send a signal to the thread.
◆ isRunning()
Check if the thread is still running.
◆ setName()
| void setName |
( |
const char * | name | ) |
|
Set the thread's name for debugging
◆ operator bool()
Check if this is a non-null thread.
◆ id()
Get an unique ID indentifying the calling thread.
◆ sleep()
| void sleep |
( |
double | duration | ) |
|
|
static |
Suspend execution of the current thread for duration seconds.
◆ sleepUntil()
| void sleepUntil |
( |
double | time | ) |
|
|
static |
Suspend execution of the current thread until time.
- See also
- System::now()
◆ blockSignals()
Block signals of given set.
◆ unblockSignals()
Unblock signals of given set.
◆ signalMask()
Query the currently active signal mask.
◆ getMinPriority()
Get minimum priority level supported by the sytem under giving scheduling policy.
◆ getMaxPriority()
Get maximum priority level supported by the sytem under giving scheduling policy.
◆ setSchedulingPolicy()
Set scheduling policy of the calling thread