12 #ifndef INCLUDE_DISTORTOS_INTERNAL_SCHEDULER_THREADCONTROLBLOCK_HPP_ 13 #define INCLUDE_DISTORTOS_INTERNAL_SCHEDULER_THREADCONTROLBLOCK_HPP_ 28 class SignalsReceiver;
34 class SignalsReceiverControlBlock;
36 class ThreadGroupControlBlock;
148 #if DISTORTOS_SIGNALS_ENABLE == 1 160 #endif // DISTORTOS_SIGNALS_ENABLE == 1 211 void setPriority(uint8_t priority,
bool alwaysBehind = {});
319 #if DISTORTOS_SIGNALS_ENABLE == 1 324 #endif // DISTORTOS_SIGNALS_ENABLE == 1 346 #endif // INCLUDE_DISTORTOS_INTERNAL_SCHEDULER_THREADCONTROLBLOCK_HPP_ ThreadControlBlock(Stack &&stack, uint8_t priority, SchedulingPolicy schedulingPolicy, ThreadGroupControlBlock *threadGroupControlBlock, SignalsReceiver *signalsReceiver, RunnableThread &owner)
ThreadControlBlock's constructor.
Definition: ThreadControlBlock.cpp:51
SignalsReceiverControlBlock * getSignalsReceiverControlBlock() const
Definition: ThreadControlBlock.hpp:155
RoundRobinQuantum class is a quantum of time for round-robin scheduling.
Definition: RoundRobinQuantum.hpp:24
ThreadState getState() const
Definition: ThreadControlBlock.hpp:184
Stack & getStack()
Definition: ThreadControlBlock.hpp:166
RunnableThread & owner_
reference to RunnableThread object that owns this ThreadControlBlock
Definition: ThreadControlBlock.hpp:311
void updateBoostedPriority(uint8_t boostedPriority={})
Updates boosted priority of the thread.
Definition: ThreadControlBlock.cpp:161
void setList(ThreadList *const list)
Sets the list that has this object.
Definition: ThreadControlBlock.hpp:195
RoundRobinQuantum & getRoundRobinQuantum()
Definition: ThreadControlBlock.hpp:125
ThreadControlBlock class is a simple description of a Thread.
Definition: ThreadControlBlock.hpp:39
ThreadGroupControlBlock class is a control block for ThreadGroup.
Definition: ThreadGroupControlBlock.hpp:26
RunnableThread class defines additional interface functions required for the thread to be actually ru...
Definition: RunnableThread.hpp:24
SignalsReceiver class is a container for internal::SignalsReceiverControlBlock.
Definition: SignalsReceiver.hpp:32
MutexControlBlock class is a control block for Mutex.
Definition: MutexControlBlock.hpp:32
ThreadListNode class header.
_reent reent_
newlib's _reent structure with thread-specific data
Definition: ThreadControlBlock.hpp:302
uintptr_t sequenceNumber_
sequence number, one half of thread identifier
Definition: ThreadControlBlock.hpp:317
SchedulingPolicy
scheduling policy of the thread
Definition: SchedulingPolicy.hpp:26
ThreadState enum class header.
SignalsReceiverControlBlock class is a structure required by threads for "receiving" of signals.
Definition: SignalsReceiverControlBlock.hpp:41
RoundRobinQuantum class header.
void blockHook(const UnblockFunctor *const unblockFunctor)
Block hook function of thread.
Definition: ThreadControlBlock.hpp:89
void setState(const ThreadState state)
Definition: ThreadControlBlock.hpp:233
~ThreadControlBlock()
ThreadControlBlock's destructor.
Definition: ThreadControlBlock.cpp:99
void setPriorityInheritanceMutexControlBlock(const MutexControlBlock *const priorityInheritanceMutexControlBlock)
Definition: ThreadControlBlock.hpp:218
Top-level namespace of distortos project.
Definition: buttons.hpp:33
sorted intrusive list of threads (thread control blocks)
Definition: ThreadList.hpp:55
void reposition(bool loweringBefore)
Repositions the thread on the list it's currently on.
Definition: ThreadControlBlock.cpp:196
SignalsReceiverControlBlock * signalsReceiverControlBlock_
pointer to SignalsReceiverControlBlock object for this thread, nullptr if this thread cannot receive ...
Definition: ThreadControlBlock.hpp:322
uintptr_t getSequenceNumber() const
Definition: ThreadControlBlock.hpp:143
Stack class is an abstraction of architecture's stack.
Definition: Stack.hpp:32
SchedulingPolicy schedulingPolicy_
scheduling policy of the thread
Definition: ThreadControlBlock.hpp:336
const MutexControlBlock * priorityInheritanceMutexControlBlock_
pointer to MutexControlBlock (with priorityInheritance protocol) that blocks this thread
Definition: ThreadControlBlock.hpp:314
int addHook()
Hook function executed when thread is added to scheduler.
Definition: ThreadControlBlock.cpp:108
SchedulingPolicy getSchedulingPolicy() const
Definition: ThreadControlBlock.hpp:134
Stack stack_
internal stack object
Definition: ThreadControlBlock.hpp:305
MutexList ownedProtocolMutexList_
list of mutexes (mutex control blocks) with enabled priority protocol owned by this thread
Definition: ThreadControlBlock.hpp:299
RoundRobinQuantum roundRobinQuantum_
round-robin quantum
Definition: ThreadControlBlock.hpp:333
Definition: UnblockFunctor.hpp:29
RunnableThread & getOwner() const
Definition: ThreadControlBlock.hpp:116
ThreadListNode class is a base for ThreadControlBlock that provides nodes for intrusive lists.
Definition: ThreadListNode.hpp:30
ThreadState state_
current state of object
Definition: ThreadControlBlock.hpp:339
const UnblockFunctor * unblockFunctor_
functor executed in unblockHook()
Definition: ThreadControlBlock.hpp:330
void setPriority(uint8_t priority, bool alwaysBehind={})
Changes priority of thread.
Definition: ThreadControlBlock.cpp:122
MutexList & getOwnedProtocolMutexList()
Definition: ThreadControlBlock.hpp:107
UnblockReason
reason of thread unblocking
Definition: UnblockReason.hpp:26
UnblockFunctor class header.
const Stack & getStack() const
Definition: ThreadControlBlock.hpp:175
ThreadState
state of the thread
Definition: ThreadState.hpp:28
ThreadList * getList() const
Definition: ThreadControlBlock.hpp:98
ThreadGroupControlBlock * threadGroupControlBlock_
pointer to ThreadGroupControlBlock with which this object is associated
Definition: ThreadControlBlock.hpp:327
ThreadList * list_
pointer to list that has this object
Definition: ThreadControlBlock.hpp:308
void unblockHook(UnblockReason unblockReason)
Unblock hook function of thread.
Definition: ThreadControlBlock.cpp:152
void setSchedulingPolicy(SchedulingPolicy schedulingPolicy)
Definition: ThreadControlBlock.cpp:144
SchedulingPolicy enum class header.
void switchedToHook()
Hook function called when context is switched to this thread.
Definition: ThreadControlBlock.hpp:246