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

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

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  MemcpyPopQueueFunctor
 MemcpyPopQueueFunctor is a functor used for popping of data from the raw queue with memcpy() 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  RunnableThread
 RunnableThread class defines additional interface functions required for the thread to be actually runnable. 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  ThreadCommon
 ThreadCommon class implements common functionality of threads. More...
 
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...
 
class  UnblockFunctor
 

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...
 

Enumerations

enum  UnblockReason : uint8_t { UnblockReason::unblockRequest, UnblockReason::timeout, UnblockReason::signal }
 reason of thread unblocking More...
 

Functions

void forceContextSwitch ()
 Forces unconditional context switch. More...
 
void threadExiter (RunnableThread &runnableThread)
 Thread "exiter" function. More...
 
void threadRunner (RunnableThread &runnableThread)
 Thread runner function - entry point of threads. More...
 
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 ()
 
constexpr SchedulergetScheduler ()
 
template<typename F >
constexpr BoundQueueFunctor< F > makeBoundQueueFunctor (F &&boundFunctor)
 Helper factory function to make BoundQueueFunctor object with deduced template arguments. More...
 

Variables

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...
 
constexpr size_t stackGuardSize
 size of "stack guard", bytes More...
 

Detailed Description

Internals of distortos project - should not be used directly!

Typedef Documentation

◆ MutexList

intrusive list of mutexes (mutex control blocks)

◆ SoftwareTimerList

Enumeration Type Documentation

◆ UnblockReason

enum distortos::internal::UnblockReason : uint8_t
strong

reason of thread unblocking

Enumerator
unblockRequest 

explicit request to unblock the thread - normal unblock

timeout 

timeout - unblock via software timer

signal 

signal handler - unblock to deliver unmasked signal

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
Here is the caller graph for this function:

◆ 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:

◆ 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

◆ threadExiter()

void distortos::internal::threadExiter ( RunnableThread runnableThread)

Thread "exiter" function.

Performs following actions:

  • thread's "exit 0" hook is executed;
  • thread is terminated and removed from scheduler;
  • thread's "exit 1" hook is executed;
  • context switch is forced;

This function never returns.

Parameters
[in]runnableThreadis a reference to RunnableThread object that is being exited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ threadRunner()

void distortos::internal::threadRunner ( RunnableThread runnableThread)

Thread runner function - entry point of threads.

Performs following actions:

  • executes thread's "run" function;
  • calls thread "exiter" function;

This function never returns.

Parameters
[in]runnableThreadis a reference to RunnableThread object that is being run
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:
{(DISTORTOS_STACK_GUARD_SIZE + DISTORTOS_ARCHITECTURE_STACK_ALIGNMENT - 1) /
DISTORTOS_ARCHITECTURE_STACK_ALIGNMENT * DISTORTOS_ARCHITECTURE_STACK_ALIGNMENT}

size of "stack guard", bytes