diff --git a/core/include/sched.h b/core/include/sched.h index 7b65fe2c9..4ca62ff7f 100644 --- a/core/include/sched.h +++ b/core/include/sched.h @@ -27,7 +27,7 @@ void sched_init(void); /** - * @brief Triggers the scheduler to select schedule the next task + * @brief Triggers the scheduler to schedule the next task */ void sched_run(void); @@ -41,11 +41,14 @@ void sched_run(void); void sched_set_status(tcb_t *process, unsigned int status); /** - * @brief Switch to thread of higher priority + * @brief Compare thread priorities and yield() (or set + * sched_context_switch_request if in_isr) when other_prio is higher + * (has a lower value) than current_prio * * @param[in] current_prio The priority of the current thread * @param[in] other_prio The priority of the target thread - * @param[in] in_isr 1 if currently in interrupt context, 0 otherwise */ + * @param[in] in_isr 1 if currently in interrupt context, 0 otherwise + */ void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr); /** @@ -54,8 +57,8 @@ void sched_switch(uint16_t current_prio, uint16_t other_prio, int in_isr); void cpu_switch_context_exit(void); /** - * Request a context switch for the next scheduler run (useful during - * interrupt handling) + * Flag indicating whether a context switch is necessary after handling an + * interrupt. Supposed to be set in an ISR. */ extern volatile unsigned int sched_context_switch_request; @@ -96,7 +99,7 @@ typedef struct { extern schedstat pidlist[MAXTHREADS]; /** - * Register a callback for every scheduler run + * Register a callback that will be called on every scheduler run */ void sched_register_cb(void (*callback)(uint32_t, uint32_t)); #endif