[][src]Function mynewt::kernel::os::os_sched

pub unsafe extern "C" fn os_sched(arg1: *mut os_task)

Performs context switch if needed. If next_t is set, that task will be made running. If next_t is NULL, highest priority ready to run is swapped in. This function can be called when new tasks were made ready to run or if the current task is moved to sleeping state.

This function will call the architecture specific routine to swap in the new task.

Return: n/a

Note: Interrupts must be disabled when calling this.

// example
os_error_t
os_mutex_release(struct os_mutex *mu)
{
    ...
    OS_EXIT_CRITICAL(sr);

    // Re-schedule if needed
    if (resched) {
        os_sched(rdy);
    }

    return OS_OK;

}