10#ifndef STK_STRATEGY_RROBIN_H_
11#define STK_STRATEGY_RROBIN_H_
205 bool handled =
false;
319template <
bool NoSleepYield>
Contains interface definitions of the library.
#define STK_UNUSED(X)
Explicitly marks a variable as unused to suppress compiler warnings.
#define STK_ASSERT(e)
Runtime assertion. Halts execution if the expression e evaluates to false.
#define __stk_constexpr_cpp17
constexpr definition for C++17 and above.
#define STK_VIRT_DTOR
Expands to nothing if STK_STRICT_COMPLIANCY=0 (non-virtual destructors, smaller objects),...
Namespace of STK package.
sched::SwitchStrategyEDF SwitchStrategyEDF __stk_attr_deprecated_type("Use stk::sched::SwitchStrategyEDF")
Task-switching strategies (stk::sched::SwitchStrategy*) and their helpers (priority bitmaps,...
SwitchStrategyRoundRobinT< true > SwitchStrategyRoundRobinNoSleepYield
Round-Robin strategy where Yield() keeps the task runnable (NOSLEEP_YIELD_API = 1).
SwitchStrategyRoundRobinT< false > SwitchStrategyRoundRobin
Shorthand alias for SwitchStrategyRoundRobinT<>.
SwitchStrategyRoundRobinT< false > SwitchStrategyRR
Shorthand alias for SwitchStrategyRoundRobin.
SwitchStrategyRoundRobinT< true > SwitchStrategyRR_NSY
Shorthand for SwitchStrategyRoundRobinNoSleepYield.
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.
DLHeadType * GetHead()
Get the list head this entry currently belongs to.
DLEntryType * GetPrev()
Get the previous entry in the list.
DLEntryType * GetNext()
Get the next entry in the list.
Round-Robin task-switching strategy: each runnable task receives one time slice (one tick interval) i...
bool OnTaskYield(IKernelTask *task) override
Notification that the running task called Yield() (non-HRT kernel modes only).
void OnTaskSleep(IKernelTask *task) override
Notification that a task has entered the sleeping state.
IKernelTask * GetFirst() override
Get first task in the managed set (reference task for the kernel, used when it starts and when all ta...
STK_NONCOPYABLE_CLASS(SwitchStrategyRoundRobinT)
IKernelTask::ListHeadType m_sleep
void AddTask(IKernelTask *task) override
Add task to the runnable set.
size_t GetSize() const override
Get total number of tasks managed by this strategy.
SwitchStrategyRoundRobinT()
Construct an empty strategy with no tasks and a null cursor.
void RemoveActive(IKernelTask *task)
Remove a task from m_tasks and update the cursor.
void RemoveTask(IKernelTask *task) override
Remove task from whichever list it currently occupies.
IKernelTask::ListHeadType m_tasks
void OnTaskWake(IKernelTask *task) override
Notification that a task has become runnable again.
IKernelTask * GetNext() override
Advance cursor and return the next runnable task.
STK_VIRT_DTOR ~SwitchStrategyRoundRobinT()=default
Destructor.
EConfig
Compile-time capability flags reported to the kernel.
@ PRIORITY_INHERITANCE_API
void AddActive(IKernelTask *task)
Append a task to m_tasks and restore the cursor if necessary.