58#include <utils/compiler.h>
61extern bool scheduler_initialized;
94static ALWAYS_INLINE
void
128static inline sched_scope_t sched_scope_constructor(
void)
130 return (sched_scope_t){
136static inline void sched_scope_destructor(sched_scope_t *scope)
147#define no_preemption_scope() \
148 for (sched_scope_t scope CLEANUP(sched_scope_destructor) = \
149 sched_scope_constructor(); \
150 !scope.done; scope.done = true)
#define IS_ERR(_x)
Check if an integer can be interpreted as an error.
Definition: error.h:83
thread_t * thread_spawn(struct process *, thread_entry_t, void *, void *, u32)
Create and initialize a new thread.
Definition: process.c:339
void(* thread_entry_t)(void *data)
A function used as an entry point when creating a new thread.
Definition: process.h:64
thread_t * current
The currently running thread.
Definition: process.c:41
void sched_unblock_thread(thread_t *)
Unblock a currently blocked thread.
Definition: sched.c:150
void sched_block_waiting_until(struct thread *, clock_t until)
Block thread and wait until a given deadline.
Definition: sched.c:175
void sched_new_thread(thread_t *)
Add a new thread to be scheduled.
Definition: sched.c:126
void sched_unblock_waiting_before(clock_t deadline)
Unblock all waiting threads whose deadline is inferior to deadline.
Definition: sched.c:182
void scheduler_preempt_enable(bool old_if_flag)
Re-allow the current thread to be pre-empted.
Definition: sched.c:110
void schedule_preempt(void)
Forcibly reschedule the current thread.
Definition: sched.c:96
void sched_block_thread(struct thread *)
Mark the thread as blocked.
Definition: sched.c:135
static ALWAYS_INLINE void sched_new_thread_create(thread_entry_t entrypoint, void *data, u32 flags)
Create a new thread and instantly schedule it.
Definition: sched.h:95
void schedule(void)
Reschedule the current thread.
Definition: sched.c:89
bool scheduler_preempt_disable(void)
Prevent the current thread from being pree-empted by the scheduler.
Definition: sched.c:103
A single thread.
Definition: process.h:121
struct process * process
Definition: process.h:132
u32 flags
Definition: process.h:139