Skip to main content

block_current_task

Function block_current_task 

Source
pub fn block_current_task()
Expand description

Block the current task and yield to the scheduler.

The current task is moved from Running to Blocked state and placed in the blocked_tasks map. It will not be re-scheduled until wake_task(id) is called.

§Lost-wakeup prevention

Before actually blocking, this function checks the task’s wake_pending flag. If a concurrent wake_task() fired between the moment the task added itself to a WaitQueue and this call, the flag will be set and the function returns immediately without blocking.

Must NOT be called with interrupts disabled or while holding the scheduler lock (this function acquires both).