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

Set current thread’s priority. To make the priority of use, the scheduling policy is determined from the value. If the value is not equal to ThreadPriority::Crossplatform(0), then the one of the available real-time policies is used. Otherwise, the function does nothing, as the only reasonable outcome with zero-priority set would be to change a scheduling policy, for which there is set_thread_priority_and_policy.

  • May require privileges
use thread_priority::*;

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