Function thread_priority::unix::set_current_thread_priority

source ·
pub fn set_current_thread_priority(
    priority: ThreadPriority
) -> Result<(), Error>
Expand description

Set current thread’s priority. In order to properly map a value of the thread priority, the thread scheduling must be known. This function attempts to retrieve the current thread’s scheduling policy and thus map the priority value correctly, so that it fits within the scheduling policy’s allowed range of values.

  • May require privileges
use thread_priority::*;

let thread_id = thread_native_id();
assert!(set_current_thread_priority(ThreadPriority::Min).is_ok());