# [−][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.

- `next_t`: Pointer to task which must run next (optional)

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;

    }

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)