distortos  v0.7.0
object-oriented C++ RTOS for microcontrollers
distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args > Class Template Reference

StaticThread class is a templated interface for thread that has automatic storage for stack. More...

#include "distortos/StaticThread.hpp"

Inheritance diagram for distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >:
[legend]
Collaboration diagram for distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >:
[legend]

Public Types

using Base = internal::StaticThreadBase< StackSize, Function, Args... >
 base of StaticThread More...
 
- Public Types inherited from distortos::internal::StaticThreadBase< StackSize, Function, Args... >
using Base = UndetachableThread
 base of StaticThreadBase More...
 
- Public Types inherited from distortos::internal::ThreadCommon
using StackStorageUniquePointer = Stack::StorageUniquePointer
 unique_ptr (with deleter) to storage for stack More...
 

Public Member Functions

 StaticThread (uint8_t priority, SchedulingPolicy schedulingPolicy, Function &&function, Args &&... args)
 StaticThread's constructor. More...
 
 StaticThread (const uint8_t priority, Function &&function, Args &&... args)
 StaticThread's constructor. More...
 
 StaticThread (const StaticThread &)=delete
 
 StaticThread (StaticThread &&)=default
 
const StaticThreadoperator= (const StaticThread &)=delete
 
StaticThreadoperator= (StaticThread &&)=delete
 
- Public Member Functions inherited from distortos::internal::StaticThreadBase< StackSize, Function, Args... >
 StaticThreadBase (const uint8_t priority, const SchedulingPolicy schedulingPolicy, SignalsReceiver *const signalsReceiver, Function &&function, Args &&... args)
 StaticThreadBase's constructor. More...
 
 StaticThreadBase (const StaticThreadBase &)=delete
 
 StaticThreadBase (StaticThreadBase &&)=default
 
const StaticThreadBaseoperator= (const StaticThreadBase &)=delete
 
StaticThreadBaseoperator= (StaticThreadBase &&)=delete
 
int start ()
 Starts the thread. More...
 
- Public Member Functions inherited from distortos::UndetachableThread
int detach () override
 Detaches the thread. More...
 
- Public Member Functions inherited from distortos::internal::ThreadCommon
 ThreadCommon (Stack &&stack, uint8_t priority, SchedulingPolicy schedulingPolicy, ThreadGroupControlBlock *threadGroupControlBlock, SignalsReceiver *signalsReceiver)
 ThreadCommon's constructor. More...
 
 ~ThreadCommon () override
 ThreadCommon's destructor. 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
 
 ThreadCommon (const ThreadCommon &)=delete
 
 ThreadCommon (ThreadCommon &&)=default
 
const ThreadCommonoperator= (const ThreadCommon &)=delete
 
ThreadCommonoperator= (ThreadCommon &&)=delete
 
- Public Member Functions inherited from distortos::Thread
virtual ~Thread ()=default
 Thread's destructor. More...
 

Additional Inherited Members

- Protected Member Functions inherited from distortos::internal::StaticThreadBase< StackSize, Function, Args... >
void run () override
 Thread's "run" function. More...
 
- Protected Member Functions inherited from distortos::internal::ThreadCommon
void exit0Hook () override
 Thread's "exit 0" hook function. More...
 
void exit1Hook () override
 Thread's "exit 1" hook function. More...
 
ThreadControlBlockgetThreadControlBlock ()
 
const ThreadControlBlockgetThreadControlBlock () const
 
int startInternal ()
 Starts the thread. More...
 

Detailed Description

template<size_t StackSize, bool CanReceiveSignals, size_t QueuedSignals, size_t SignalActions, typename Function, typename... Args>
class distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >

StaticThread class is a templated interface for thread that has automatic storage for stack.

Template Parameters
StackSizeis the size of stack, bytes
CanReceiveSignalsselects whether reception of signals is enabled (true) or disabled (false) for this thread
QueuedSignalsis the max number of queued signals for this thread, relevant only if CanReceiveSignals == true, 0 to disable queuing of signals for this thread
SignalActionsis the max number of different SignalAction objects for this thread, relevant only if CanReceiveSignals == true, 0 to disable catching of signals for this thread
Functionis the function that will be executed in separate thread
Argsare the arguments for Function

Member Typedef Documentation

◆ Base

template<size_t StackSize, bool CanReceiveSignals, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
using distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >::Base = internal::StaticThreadBase<StackSize, Function, Args...>

base of StaticThread

Constructor & Destructor Documentation

◆ StaticThread() [1/2]

template<size_t StackSize, bool CanReceiveSignals, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >::StaticThread ( uint8_t  priority,
SchedulingPolicy  schedulingPolicy,
Function &&  function,
Args &&...  args 
)

StaticThread's constructor.

Parameters
[in]priorityis the thread's priority, 0 - lowest, UINT8_MAX - highest
[in]schedulingPolicyis the scheduling policy of the thread
[in]functionis a function that will be executed in separate thread
[in]argsare arguments for function

◆ StaticThread() [2/2]

template<size_t StackSize, bool CanReceiveSignals, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
distortos::StaticThread< StackSize, CanReceiveSignals, QueuedSignals, SignalActions, Function, Args >::StaticThread ( const uint8_t  priority,
Function &&  function,
Args &&...  args 
)
inline

StaticThread's constructor.

Parameters
[in]priorityis the thread's priority, 0 - lowest, UINT8_MAX - highest
[in]functionis a function that will be executed in separate thread
[in]argsare arguments for function

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