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

StaticThread class is a templated interface for thread that has automatic storage for stack and internal StaticSignalsReceiver object. More...

#include <StaticThread.hpp>

Inheritance diagram for distortos::StaticThread< StackSize, true, QueuedSignals, SignalActions, Function, Args... >:
[legend]
Collaboration diagram for distortos::StaticThread< StackSize, true, 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::ThreadCommon
using StackStorageUniquePointer = internal::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::ThreadCommon
 ThreadCommon (internal::Stack &&stack, uint8_t priority, SchedulingPolicy schedulingPolicy, internal::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
 
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 ()=0
 Thread's destructor. More...
 

Private Attributes

StaticSignalsReceiver< QueuedSignals, SignalActions > staticSignalsReceiver_
 internal StaticSignalsReceiver object More...
 

Additional Inherited Members

- Protected Member Functions inherited from distortos::ThreadCommon
internal::ThreadControlBlockgetThreadControlBlock ()
 
const internal::ThreadControlBlockgetThreadControlBlock () const
 
int startInternal (void(&runFunction)(Thread &), void(*preTerminationHookFunction)(Thread &), void(&terminationHookFunction)(Thread &))
 Starts the thread. More...
 
- Static Protected Member Functions inherited from distortos::ThreadCommon
static void terminationHook (Thread &thread)
 Termination hook function of thread. More...
 

Detailed Description

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

StaticThread class is a templated interface for thread that has automatic storage for stack and internal StaticSignalsReceiver object.

Specialization for threads with enabled reception of signals (CanReceiveSignals == true)

Template Parameters
StackSizeis the size of stack, bytes
QueuedSignalsis the max number of queued signals for this thread, 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, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
using distortos::StaticThread< StackSize, true, QueuedSignals, SignalActions, Function, Args... >::Base = internal::StaticThreadBase<StackSize, Function, Args...>

base of StaticThread

Constructor & Destructor Documentation

◆ StaticThread() [1/2]

template<size_t StackSize, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
distortos::StaticThread< StackSize, true, 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, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
distortos::StaticThread< StackSize, true, 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

Member Data Documentation

◆ staticSignalsReceiver_

template<size_t StackSize, size_t QueuedSignals, size_t SignalActions, typename Function , typename... Args>
StaticSignalsReceiver<QueuedSignals, SignalActions> distortos::StaticThread< StackSize, true, QueuedSignals, SignalActions, Function, Args... >::staticSignalsReceiver_
private

internal StaticSignalsReceiver object


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