distortos  v0.5.0
object-oriented C++ RTOS for microcontrollers
distortos::internal Namespace Reference

Internals of distortos project - should not be used directly! More...

Namespaces

Classes

class  BoundQueueFunctor
 BoundQueueFunctor is a type-erased QueueFunctor which calls its bound functor to execute actions on queue's storage. More...
 
class  CopyConstructQueueFunctor
 
class  DeferredThreadDeleter
 DeferredThreadDeleter class can be used to defer deletion of dynamic detached threads. More...
 
class  DynamicThreadBase
 DynamicThreadBase class is a type-erased interface for thread that has dynamic storage for bound function, stack and - if signals are enabled - internal DynamicSignalsReceiver object. More...
 
class  FifoQueueBase
 FifoQueueBase class implements basic functionality of FifoQueue template class. More...
 
class  InterruptMaskingUnmaskingLock
 InterruptMaskingUnmaskingLock class is a RAII wrapper for interrupt mask manipulation. More...
 
class  InterruptUnmaskingLock
 
class  MainThread
 MainThread class is a Thread for main() More...
 
class  MemcpyPopQueueFunctor
 MemcpyPopQueueFunctor is a functor used for popping of data from the raw queue with memecpy() More...
 
class  MemcpyPushQueueFunctor
 MemcpyPushQueueFunctor is a functor used for pushing of data to the raw queue with memcpy() More...
 
class  MessageQueueBase
 MessageQueueBase class implements basic functionality of MessageQueue template class. More...
 
class  MoveConstructQueueFunctor
 
class  MutexControlBlock
 MutexControlBlock class is a control block for Mutex. More...
 
class  MutexListNode
 MutexListNode class is a base for MutexControlBlock that serves as a node in intrusive list of mutexes (mutex control blocks) More...
 
class  QueueFunctor
 QueueFunctor is a type-erased interface for functors which execute some action on queue's storage (like copy-constructing, swapping, destroying, emplacing, ...). More...
 
class  RoundRobinQuantum
 RoundRobinQuantum class is a quantum of time for round-robin scheduling. More...
 
class  Scheduler
 Scheduler class is a system's scheduler. More...
 
class  SemaphoreFunctor
 SemaphoreFunctor is a type-erased interface for functors which execute some action on semaphore (wait(), tryWait(), tryWaitFor(), tryWaitUntil(), ...). More...
 
class  SemaphoreTryWaitForFunctor
 SemaphoreTryWaitForFunctor class is a SemaphoreFunctor which calls Semaphore::tryWaitFor() with bound duration. More...
 
class  SemaphoreTryWaitFunctor
 SemaphoreTryWaitFunctor class is a SemaphoreFunctor which calls Semaphore::tryWait() More...
 
class  SemaphoreTryWaitUntilFunctor
 
class  SemaphoreWaitFunctor
 SemaphoreWaitFunctor class is a SemaphoreFunctor which calls Semaphore::wait() More...
 
class  SignalInformationQueue
 SignalInformationQueue class can be used for queuing of SignalInformation objects. More...
 
class  SignalsCatcherControlBlock
 SignalsCatcherControlBlock class is a structure required by threads for "catching" and "handling" of signals. More...
 
class  SignalsReceiverControlBlock
 SignalsReceiverControlBlock class is a structure required by threads for "receiving" of signals. More...
 
struct  SoftwareTimerAscendingTimePoint
 functor which gives ascending expiration time point order of elements on the list More...
 
class  SoftwareTimerControlBlock
 SoftwareTimerControlBlock class is a control block of software timer. More...
 
class  SoftwareTimerListNode
 SoftwareTimerListNode class is a base for SoftwareTimerControlBlock that serves as a node in intrusive list of software timers (software timer control blocks) More...
 
class  SoftwareTimerSupervisor
 SoftwareTimerSupervisor class is a supervisor of software timers. More...
 
class  Stack
 Stack class is an abstraction of architecture's stack. More...
 
class  StaticThreadBase
 StaticThreadBase class is a templated common base for StaticThread. More...
 
class  SwapPopQueueFunctor
 
class  ThreadControlBlock
 ThreadControlBlock class is a simple description of a Thread. More...
 
struct  ThreadDescendingEffectivePriority
 functor which gives descending effective priority order of elements on the list More...
 
class  ThreadGroupControlBlock
 ThreadGroupControlBlock class is a control block for ThreadGroup. More...
 
class  ThreadList
 sorted intrusive list of threads (thread control blocks) More...
 
class  ThreadListNode
 ThreadListNode class is a base for ThreadControlBlock that provides nodes for intrusive lists. More...
 

Typedefs

using SoftwareTimerList = estd::SortedIntrusiveList< SoftwareTimerAscendingTimePoint, SoftwareTimerListNode, &SoftwareTimerListNode::node, SoftwareTimerControlBlock >
 sorted intrusive list of software timers (software timer control blocks) More...
 
using MutexList = estd::IntrusiveList< MutexListNode, &MutexListNode::node, MutexControlBlock >
 intrusive list of mutexes (mutex control blocks) More...
 

Functions

template<typename T , typename U >
void dummyDeleter (U *)
 A "no-op" dummy deleter that can be used with std::unique_ptr and automatic storage that is trivially destructible. More...
 
constexpr DeferredThreadDeletergetDeferredThreadDeleter ()
 
template<typename T , typename U >
void storageDeleter (U *const storage)
 Templated deleter that can be used with std::unique_ptr and dynamic storage allocated with new T[]. More...
 
constexpr MutexgetMallocMutex ()
 
void forceContextSwitch ()
 Forces unconditional context switch. More...
 
constexpr SchedulergetScheduler ()
 
void idleThreadFunction ()
 Idle thread's function. More...
 
void lowLevelInitialization ()
 Low level system initialization. More...
 
void threadRunner (Thread &thread, void(&run)(Thread &), void(*preTerminationHook)(Thread &), void(&terminationHook)(Thread &))
 Thread runner function - entry point of threads. More...
 
template<typename F >
constexpr BoundQueueFunctor< F > makeBoundQueueFunctor (F &&boundFunctor)
 Helper factory function to make BoundQueueFunctor object with deduced template arguments. More...
 

Variables

constexpr size_t stackGuardSize
 size of "stack guard", bytes More...
 
DeferredThreadDeleter deferredThreadDeleterInstance
 main instance of DeferredThreadDeleter More...
 
Mutex mallocMutexInstance {Mutex::Type::recursive, Mutex::Protocol::priorityInheritance}
 main instance of Mutex used for malloc() and free() locking More...
 
Scheduler schedulerInstance
 main instance of system's Scheduler More...
 

Detailed Description

Internals of distortos project - should not be used directly!

Typedef Documentation

◆ MutexList

intrusive list of mutexes (mutex control blocks)

◆ SoftwareTimerList

Function Documentation

◆ dummyDeleter()

template<typename T , typename U >
void distortos::internal::dummyDeleter ( U *  )

A "no-op" dummy deleter that can be used with std::unique_ptr and automatic storage that is trivially destructible.

Template Parameters
Tis the real type of storage, must be trivially destructible
Uis the type of storage pointer
Parameters
[in]storageis a pointer to storage

◆ forceContextSwitch()

void distortos::internal::forceContextSwitch ( )

Forces unconditional context switch.

Requests unconditional context switch and temporarily disables any interrupt masking.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDeferredThreadDeleter()

constexpr DeferredThreadDeleter& distortos::internal::getDeferredThreadDeleter ( )
Returns
reference to main instance of DeferredThreadDeleter
Here is the caller graph for this function:

◆ getMallocMutex()

constexpr Mutex& distortos::internal::getMallocMutex ( )
Returns
reference to main instance of Mutex used for malloc() and free() locking
Here is the caller graph for this function:

◆ getScheduler()

constexpr Scheduler& distortos::internal::getScheduler ( )
Returns
reference to main instance of system's Scheduler
Here is the caller graph for this function:

◆ idleThreadFunction()

void distortos::internal::idleThreadFunction ( )

Idle thread's function.

Here is the call graph for this function:

◆ lowLevelInitialization()

void distortos::internal::lowLevelInitialization ( )

Low level system initialization.

Low level board initialization.

  1. Initializes main instance of system's Scheduler;
  2. Initializes main thread with its group;
  3. Starts idle thread;
  4. Initializes main instance of Mutex used for malloc() and free() locking;
  5. Initializes main instance of DeferredThreadDeleter (only if CONFIG_THREAD_DETACH_ENABLE option is enabled);

This function is called before constructors for global and static objects from __libc_init_array() via address in distortosPreinitArray[].

Here is the caller graph for this function:

◆ makeBoundQueueFunctor()

template<typename F >
constexpr BoundQueueFunctor<F> distortos::internal::makeBoundQueueFunctor ( F &&  boundFunctor)

Helper factory function to make BoundQueueFunctor object with deduced template arguments.

Template Parameters
Fis the type of bound functor, it will be called with void* as only argument
Parameters
[in]boundFunctoris a rvalue reference to bound functor which will be used to move-construct returned object
Returns
BoundQueueFunctor object with deduced template arguments
Here is the caller graph for this function:

◆ storageDeleter()

template<typename T , typename U >
void distortos::internal::storageDeleter ( U *const  storage)

Templated deleter that can be used with std::unique_ptr and dynamic storage allocated with new T[].

Template Parameters
Tis the real type of allocated storage
Uis the type of storage pointer
Parameters
[in]storageis a pointer to storage that will be deleted

◆ threadRunner()

void distortos::internal::threadRunner ( Thread thread,
void(&)(Thread &)  run,
void(*)(Thread &)  preTerminationHook,
void(&)(Thread &)  terminationHook 
)

Thread runner function - entry point of threads.

Performs following actions:

  • executes thread's "run" function;
  • thread's pre-termination hook is executed (if provided);
  • thread is terminated and removed from scheduler;
  • thread's termination hook is executed;
  • context switch is forced;

This function never returns.

Parameters
[in]threadis a reference to Thread object that is being run
[in]runis a reference to Thread's "run" function
[in]preTerminationHookis a pointer to Thread's pre-termination hook, nullptr to skip
[in]terminationHookis a reference to Thread's termination hook
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ deferredThreadDeleterInstance

DeferredThreadDeleter distortos::internal::deferredThreadDeleterInstance

main instance of DeferredThreadDeleter

◆ mallocMutexInstance

Mutex distortos::internal::mallocMutexInstance {Mutex::Type::recursive, Mutex::Protocol::priorityInheritance}

main instance of Mutex used for malloc() and free() locking

◆ schedulerInstance

Scheduler distortos::internal::schedulerInstance

main instance of system's Scheduler

◆ stackGuardSize

constexpr size_t distortos::internal::stackGuardSize
Initial value:
{(CONFIG_STACK_GUARD_SIZE + CONFIG_ARCHITECTURE_STACK_ALIGNMENT - 1) /
CONFIG_ARCHITECTURE_STACK_ALIGNMENT * CONFIG_ARCHITECTURE_STACK_ALIGNMENT}

size of "stack guard", bytes