Function set_current_thread_priority
pub fn set_current_thread_priority(
priority: ThreadPriority,
) -> Result<(), Error>Available on Linux or macOS or iOS or DragonFly BSD or FreeBSD or OpenBSD or
target_os=vxworks or NetBSD or Android 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());