zephyr::raw

Function k_thread_priority_set

Source
pub unsafe extern "C" fn k_thread_priority_set(
    thread: *mut k_thread,
    prio: i32,
)
Expand description

@brief Set a thread’s priority.

This routine immediately changes the priority of @a thread.

Rescheduling can occur immediately depending on the priority @a thread is set to:

  • If its priority is raised above the priority of a currently scheduled preemptible thread, @a thread will be scheduled in.

  • If the caller lowers the priority of a currently scheduled preemptible thread below that of other threads in the system, the thread of the highest priority will be scheduled in.

Priority can be assigned in the range of -CONFIG_NUM_COOP_PRIORITIES to CONFIG_NUM_PREEMPT_PRIORITIES-1, where -CONFIG_NUM_COOP_PRIORITIES is the highest priority.

@param thread ID of thread whose priority is to be set. @param prio New priority.

@warning Changing the priority of a thread currently involved in mutex priority inheritance may result in undefined behavior.