10#ifndef STK_STRATEGY_RROBIN_H_
11#define STK_STRATEGY_RROBIN_H_
Contains interface definitions of the library.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
Namespace of STK package.
SwitchStrategyRoundRobin SwitchStrategyRR
Shorthand alias for SwitchStrategyRoundRobin.
Scheduling-strategy-facing interface for a kernel task slot.
DLHeadType ListHeadType
List head type for IKernelTask elements.
virtual bool IsSleeping() const =0
Check whether the task is currently sleeping.
Interface for a task switching strategy implementation.
DLEntryType * GetPrev() const
Get the previous entry in the list.
DLHeadType * GetHead() const
Get the list head this entry currently belongs to.
DLEntryType * GetNext() const
Get the next entry in the list.
Round-Robin task-switching strategy: each runnable task receives one time slice (one tick interval) i...
IKernelTask::ListHeadType m_tasks
Runnable tasks eligible for scheduling.
~SwitchStrategyRoundRobin()
Destructor.
void RemoveActive(IKernelTask *task)
Remove a task from m_tasks and update the cursor.
size_t GetSize() const
Get total number of tasks managed by this strategy.
IKernelTask::ListHeadType m_sleep
Sleeping (blocked) tasks not eligible for scheduling.
void AddActive(IKernelTask *task)
Append a task to m_tasks and restore the cursor if necessary.
SwitchStrategyRoundRobin()
Construct an empty strategy with no tasks and a null cursor.
EConfig
Compile-time capability flags reported to the kernel.
@ SLEEP_EVENT_API
This strategy requires OnTaskSleep() / OnTaskWake() events to maintain the active/sleep list split.
@ DEADLINE_MISSED_API
This strategy does not use OnTaskDeadlineMissed() events.
@ WEIGHT_API
This strategy does not use per-task weights; all tasks are treated equally.
void OnTaskWake(IKernelTask *task)
Notification that a task has become runnable again.
IKernelTask * GetFirst() const
Get first task in the managed set (used by the kernel for initial scheduling).
IKernelTask * GetNext()
Advance cursor and return the next runnable task.
void AddTask(IKernelTask *task)
Add task to the runnable set.
void RemoveTask(IKernelTask *task)
Remove task from whichever list it currently occupies.
void OnTaskSleep(IKernelTask *task)
Notification that a task has entered the sleeping state.
STK_NONCOPYABLE_CLASS(SwitchStrategyRoundRobin)
IKernelTask * m_prev
Iterator cursor: the most recently scheduled task, or nullptr when no runnable tasks exist....
bool OnTaskDeadlineMissed(IKernelTask *)
Not supported, asserts unconditionally.