99 #if defined(MODULE_CORE_THREAD) 
  100 #define MAXTHREADS 32 
  109 #define KERNEL_PID_UNDEF 0 
  114 #define KERNEL_PID_FIRST (KERNEL_PID_UNDEF + 1) 
  119 #define KERNEL_PID_LAST (KERNEL_PID_FIRST + MAXTHREADS - 1) 
  124 #define PRIkernel_pid PRIi16 
  126 #if defined(DEVELHELP) || defined(DOXYGEN) 
  130 #ifndef SCHED_TEST_STACK 
  131 #define SCHED_TEST_STACK    1 
  184 #define STATUS_ON_RUNQUEUE      STATUS_RUNNING   
  186 #define STATUS_NOT_FOUND ((thread_status_t)~0)   
  192 #ifndef SCHED_PRIO_LEVELS 
  193 #define SCHED_PRIO_LEVELS 16 
  287 #if IS_USED(MODULE_SCHED_CB) || defined(DOXYGEN) 
  327 #if (IS_USED(MODULE_SCHED_RUNQ_CALLBACK)) || defined(DOXYGEN) 
static bool clist_more_than_one(clist_node_t *list)
Tells if a list has more than one element.
 
static bool clist_is_empty(const clist_node_t *list)
Checks if *list is empty.
 
static void clist_lpoprpush(clist_node_t *list)
Advances the circle list.
 
static bool clist_exactly_one(clist_node_t *list)
Tells if a list has exactly one element.
 
#define NORETURN
The NORETURN keyword tells the compiler to assume that the function cannot return.
 
#define SCHED_PRIO_LEVELS
The number of thread priority levels.
 
static int sched_runq_more_than_one(uint8_t prio)
Tell if the number of threads in a runqueue greater than 1.
 
void sched_register_cb(sched_callback_t callback)
Register a callback that will be called on every scheduler run.
 
void sched_arch_idle(void)
Set CPU to idle mode (CPU dependent)
 
static int pid_is_valid(kernel_pid_t pid)
Determine if the given pid is valid.
 
volatile int sched_num_threads
Number of running (non-terminated) threads.
 
void sched_runq_callback(uint8_t prio)
Scheduler runqueue (change) callback.
 
static int sched_runq_exactly_one(uint8_t prio)
Tell if the number of threads in a runqueue is 1.
 
void(* sched_callback_t)(kernel_pid_t active, kernel_pid_t next)
Scheduler run callback.
 
#define KERNEL_PID_LAST
The last valid PID (inclusive).
 
int16_t kernel_pid_t
Unique process identifier.
 
volatile unsigned int sched_context_switch_request
Flag indicating whether a context switch is necessary after handling an interrupt.
 
void sched_switch(uint16_t other_prio)
Yield if appropriate.
 
void sched_set_status(thread_t *process, thread_status_t status)
Set the status of the specified process.
 
NORETURN void sched_task_exit(void)
Removes thread from scheduler and set status to STATUS_STOPPED.
 
void sched_change_priority(thread_t *thread, uint8_t priority)
Change the priority of the given thread.
 
volatile thread_t * sched_threads[KERNEL_PID_LAST+1]
Thread table.
 
thread_t * sched_run(void)
Triggers the scheduler to schedule the next thread.
 
static int sched_runq_is_empty(uint8_t prio)
Tell if the number of threads in a runqueue is 0.
 
static void sched_runq_advance(uint8_t prio)
Advance a runqueue.
 
NORETURN void cpu_switch_context_exit(void)
Call context switching at thread exit.
 
#define KERNEL_PID_FIRST
The first valid PID (inclusive).
 
clist_node_t sched_runqueues[SCHED_PRIO_LEVELS]
List of runqueues per priority level.
 
@ STATUS_COND_BLOCKED
waiting for a condition variable
 
@ STATUS_RUNNING
currently running
 
@ STATUS_MUTEX_BLOCKED
waiting for a locked mutex
 
@ STATUS_STOPPED
has terminated
 
@ STATUS_SLEEPING
sleeping
 
@ STATUS_FLAG_BLOCKED_ANY
waiting for any flag from flag_mask
 
@ STATUS_SEND_BLOCKED
waiting for message to be delivered
 
@ STATUS_MBOX_BLOCKED
waiting for get/put on mbox
 
@ STATUS_PENDING
waiting to be scheduled to run
 
@ STATUS_NUMOF
number of supported thread states
 
@ STATUS_REPLY_BLOCKED
waiting for a message response
 
@ STATUS_ZOMBIE
has terminated & keeps thread's thread_t
 
@ STATUS_FLAG_BLOCKED_ALL
waiting for all flags in flag_mask
 
@ STATUS_RECEIVE_BLOCKED
waiting for a message
 
Adds include for missing inttype definitions.
 
Common macros and compiler attributes/pragmas configuration.
 
Add definitions required on the native board.
 
thread_t holds thread's context data.
 
thread_status_t status
thread's status
 
uint8_t priority
thread's priority