Scheduler namespace. More...
Namespaces | |
namespace | statistics |
Scheduler statistics. | |
Classes | |
class | critical_section |
Scheduler critical section RAII helper. More... | |
class | lockable |
Scheduler standard locker. More... | |
class | uncritical_section |
Scheduler uncritical section RAII helper. More... | |
Typedefs | |
using | state_t = port::scheduler::state_t |
Type of variables holding scheduler state codes. | |
Functions | |
thread::threads_list & | children_threads (thread *th) |
Get the children threads. | |
result_t | initialize (void) |
Initialise the RTOS scheduler. | |
state_t | lock (void) |
Lock the scheduler. | |
state_t | locked (state_t state) |
Lock/unlock the scheduler. | |
bool | locked (void) |
Check if the scheduler is locked. | |
bool | preemptive (bool state) |
Set the scheduler preemptive mode. | |
bool | preemptive (void) |
Check if the scheduler is in preemptive mode. | |
void | start (void) |
Start the RTOS scheduler. | |
bool | started (void) |
Check if the scheduler was started. | |
state_t | unlock (void) |
Unlock the scheduler. | |
Scheduler namespace.
The os::rtos::scheduler
namespace groups scheduler types and functions.
using os::rtos::scheduler::state_t = typedef port::scheduler::state_t |
Type of variables holding scheduler state codes.
Usually a boolean telling if the scheduler is locked or not, but for recursive locks it might also be a numeric counter.
Definition at line 202 of file os-decls.h.
thread::threads_list & os::rtos::scheduler::children_threads | ( | thread * | th | ) |
Get the children threads.
[in] | th | Pointer to thread or nullptr. |
If the input pointer is nullptr, the function returns the list of top level threads.
Definition at line 261 of file os-core.cpp.
result_t os::rtos::scheduler::initialize | ( | void | ) |
Initialise the RTOS scheduler.
result::ok | The scheduler was initialised. |
EPERM | Cannot be invoked from an Interrupt Service Routines. |
Initialise all RTOS internal objects and be ready to run.
Must be called only once, usually in main().
Definition at line 160 of file os-core.cpp.
|
inline |
Lock the scheduler.
Set the scheduler lock state to locked and return the previous state.
Definition at line 869 of file os-sched.h.
Lock/unlock the scheduler.
[in] | state | The new state of the scheduler lock. |
Set the scheduler lock state based on the parameter and return the previous state.
This allows to implement scheduler critical sections, where the scheduler is disabled and context switches are not performed.
Definition at line 899 of file os-sched.h.
|
inline |
Check if the scheduler is locked.
true | The scheduler is locked. |
false | The scheduler is switching threads (not locked). |
Check if the scheduler is locked on the current thread or is switching threads from the ready list.
Definition at line 856 of file os-sched.h.
bool os::rtos::scheduler::preemptive | ( | bool | state | ) |
Set the scheduler preemptive mode.
[in] | state | The new state of the scheduler preemptive mode. |
Definition at line 227 of file os-core.cpp.
|
inline |
Check if the scheduler is in preemptive mode.
true | The scheduler is in preemptive mode. |
false | The scheduler is not in preemptive mode. |
Check if the scheduler preemption is enabled.
Definition at line 839 of file os-sched.h.
void os::rtos::scheduler::start | ( | void | ) |
Start the RTOS scheduler.
The scheduler cannot be stopped, it will run forever, but thread switching can be locked/unlocked.
Definition at line 189 of file os-core.cpp.
|
inline |
Check if the scheduler was started.
true | The scheduler was started. |
false | The scheduler was not started. |
Check if the scheduler was started, i.e. if scheduler::start() was called.
Definition at line 827 of file os-sched.h.
|
inline |
Unlock the scheduler.
Set the scheduler lock state to unlocked and return the previous state.
Definition at line 882 of file os-sched.h.