DynamicThread class is a type-erased interface for thread that has dynamic storage for bound function, stack and internal DynamicSignalsReceiver object.
More...
#include "distortos/DynamicThread.hpp"
|
template<typename Function , typename... Args> |
| DynamicThread (size_t stackSize, bool canReceiveSignals, size_t queuedSignals, size_t signalActions, uint8_t priority, SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args) |
| DynamicThread's constructor. More...
|
|
template<typename Function , typename... Args> |
| DynamicThread (const DynamicThreadParameters parameters, Function &&function, Args &&... args) |
| DynamicThread's constructor. More...
|
|
| ~DynamicThread () override |
| DynamicThread's destructor. More...
|
|
int | detach () override |
| Detaches the thread. More...
|
|
int | generateSignal (uint8_t signalNumber) override |
| Generates signal for thread. More...
|
|
uint8_t | getEffectivePriority () const override |
|
ThreadIdentifier | getIdentifier () const override |
|
SignalSet | getPendingSignalSet () const override |
| Gets set of currently pending signals. More...
|
|
uint8_t | getPriority () const override |
|
SchedulingPolicy | getSchedulingPolicy () const override |
|
size_t | getStackHighWaterMark () const override |
|
size_t | getStackSize () const override |
|
ThreadState | getState () const override |
|
int | join () override |
| Waits for thread termination. More...
|
|
int | queueSignal (uint8_t signalNumber, sigval value) override |
| Queues signal for thread. More...
|
|
void | setPriority (uint8_t priority, bool alwaysBehind={}) override |
| Changes priority of thread. More...
|
|
void | setSchedulingPolicy (SchedulingPolicy schedulingPolicy) override |
|
int | start () |
| Starts the thread. More...
|
|
| DynamicThread (const DynamicThread &)=delete |
|
| DynamicThread (DynamicThread &&)=default |
|
const DynamicThread & | operator= (const DynamicThread &)=delete |
|
DynamicThread & | operator= (DynamicThread &&)=delete |
|
virtual | ~Thread ()=default |
| Thread's destructor. More...
|
|
DynamicThread class is a type-erased interface for thread that has dynamic storage for bound function, stack and internal DynamicSignalsReceiver object.
◆ DynamicThread() [1/2]
template<typename Function , typename... Args>
distortos::DynamicThread::DynamicThread |
( |
size_t |
stackSize, |
|
|
bool |
canReceiveSignals, |
|
|
size_t |
queuedSignals, |
|
|
size_t |
signalActions, |
|
|
uint8_t |
priority, |
|
|
SchedulingPolicy |
schedulingPolicy, |
|
|
Function && |
function, |
|
|
Args &&... |
args |
|
) |
| |
DynamicThread's constructor.
- Template Parameters
-
Function | is the function that will be executed in separate thread |
Args | are the arguments for Function |
- Parameters
-
[in] | stackSize | is the size of stack, bytes |
[in] | canReceiveSignals | selects whether reception of signals is enabled (true) or disabled (false) for this thread |
[in] | queuedSignals | is the max number of queued signals for this thread, relevant only if canReceiveSignals == true, 0 to disable queuing of signals for this thread |
[in] | signalActions | is the max number of different SignalAction objects for this thread, relevant only if canReceiveSignals == true, 0 to disable catching of signals for this thread |
[in] | priority | is the thread's priority, 0 - lowest, UINT8_MAX - highest |
[in] | schedulingPolicy | is the scheduling policy of the thread |
[in] | function | is a function that will be executed in separate thread |
[in] | args | are arguments for function |
◆ DynamicThread() [2/2]
template<typename Function , typename... Args>
distortos::DynamicThread::DynamicThread |
( |
const DynamicThreadParameters |
parameters, |
|
|
Function && |
function, |
|
|
Args &&... |
args |
|
) |
| |
|
inline |
DynamicThread's constructor.
- Template Parameters
-
Function | is the function that will be executed in separate thread |
Args | are the arguments for Function |
- Parameters
-
[in] | parameters | is a DynamicThreadParameters struct with thread parameters |
[in] | function | is a function that will be executed in separate thread |
[in] | args | are arguments for function |
◆ ~DynamicThread()
distortos::DynamicThread::~DynamicThread |
( |
| ) |
|
|
override |
◆ detach()
int distortos::DynamicThread::detach |
( |
| ) |
|
|
overridevirtual |
◆ getEffectivePriority()
uint8_t distortos::DynamicThread::getEffectivePriority |
( |
| ) |
const |
|
overridevirtual |
◆ getIdentifier()
- Returns
- identifier of thread, default-constructed ThreadIdentifier if this object doesn't represent a valid thread of execution (e.g. after the thread is detached)
Implements distortos::Thread.
◆ getPriority()
uint8_t distortos::DynamicThread::getPriority |
( |
| ) |
const |
|
overridevirtual |
◆ getSchedulingPolicy()
◆ getStackHighWaterMark()
size_t distortos::DynamicThread::getStackHighWaterMark |
( |
| ) |
const |
|
overridevirtual |
- Returns
- "high water mark" (max usage) of thread's stack, bytes
Implements distortos::Thread.
◆ getStackSize()
size_t distortos::DynamicThread::getStackSize |
( |
| ) |
const |
|
overridevirtual |
◆ getState()
ThreadState distortos::DynamicThread::getState |
( |
| ) |
const |
|
overridevirtual |
◆ setPriority()
void distortos::DynamicThread::setPriority |
( |
uint8_t |
priority, |
|
|
bool |
alwaysBehind = {} |
|
) |
| |
|
overridevirtual |
Changes priority of thread.
If the priority really changes, the position in the thread list is adjusted and context switch may be requested.
- Parameters
-
[in] | priority | is the new priority of thread |
[in] | alwaysBehind | selects the method of ordering when lowering the priority
- false - the thread is moved to the head of the group of threads with the new priority (default),
- true - the thread is moved to the tail of the group of threads with the new priority.
|
Implements distortos::Thread.
◆ setSchedulingPolicy()
void distortos::DynamicThread::setSchedulingPolicy |
( |
SchedulingPolicy |
schedulingPolicy | ) |
|
|
overridevirtual |
param [in] schedulingPolicy is the new scheduling policy of the thread
Implements distortos::Thread.
◆ start()
int distortos::DynamicThread::start |
( |
| ) |
|
Starts the thread.
This operation can be performed on threads in "created" state only.
- Returns
- 0 on success, error code otherwise:
◆ detachableThread_
The documentation for this class was generated from the following files: