Function set_current_thread_priority
pub fn set_current_thread_priority(
priority: ThreadPriority,
) -> Result<(), Error>Available on crate feature
tasks and (Android or DragonFly BSD or FreeBSD or iOS or Linux or macOS or NetBSD or OpenBSD or VxWorks or WebAssembly) only.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());