PebbleOS
Loading...
Searching...
No Matches
Functions
Scheduler

Scheduler start, preemption control and uptime. More...

Functions

void pbl_kernel_start (void)
 Start the scheduler.
 
bool pbl_kernel_is_started (void)
 Check whether the scheduler has started.
 
bool pbl_kernel_is_running (void)
 Check whether threads are being scheduled.
 
void pbl_sched_lock (void)
 Disable preemption.
 
void pbl_sched_unlock (void)
 Undo one pbl_sched_lock(), performing any deferred switch at the outermost one.
 
bool pbl_sched_is_locked (void)
 Check whether preemption is disabled.
 
pbl_tick_t pbl_uptime_ticks (void)
 Get the time since the scheduler started.
 

Detailed Description

Scheduler start, preemption control and uptime.

pbl_sched_lock() keeps the calling thread running without masking interrupts: switches requested meanwhile, e.g. by an ISR waking a higher priority thread, happen at the outermost pbl_sched_unlock(). Blocking while the scheduler is locked is not allowed.

prv_update_shared_state();
void pbl_sched_lock(void)
Disable preemption.
void pbl_sched_unlock(void)
Undo one pbl_sched_lock(), performing any deferred switch at the outermost one.

Function Documentation

◆ pbl_kernel_is_running()

bool pbl_kernel_is_running ( void  )

Check whether threads are being scheduled.

Returns
true if the scheduler has started and is not locked.

◆ pbl_kernel_is_started()

bool pbl_kernel_is_started ( void  )

Check whether the scheduler has started.

Returns
true once pbl_kernel_start() has run.

◆ pbl_kernel_start()

void pbl_kernel_start ( void  )

Start the scheduler.

Creates the idle thread and switches to the highest priority thread. Called once from main(), after the first threads have been created.

◆ pbl_sched_is_locked()

bool pbl_sched_is_locked ( void  )

Check whether preemption is disabled.

Returns
true while pbl_sched_lock() is in effect.

◆ pbl_sched_lock()

void pbl_sched_lock ( void  )

Disable preemption.

ISRs still run. Nestable; balance each call with pbl_sched_unlock().

◆ pbl_sched_unlock()

void pbl_sched_unlock ( void  )

Undo one pbl_sched_lock(), performing any deferred switch at the outermost one.

◆ pbl_uptime_ticks()

pbl_tick_t pbl_uptime_ticks ( void  )

Get the time since the scheduler started.

Returns
Ticks elapsed, including time spent in tickless sleep. Wraps around.