Function thread_priority::unix::set_thread_priority_and_policy
source · [−]pub fn set_thread_priority_and_policy(
native: ThreadId,
priority: ThreadPriority,
policy: ThreadSchedulePolicy
) -> Result<(), Error>
Expand description
Sets thread’s priority and schedule policy
- May require privileges
Usage
Setting thread priority to minimum with normal schedule policy:
use thread_priority::*;
let thread_id = thread_native_id();
assert!(set_thread_priority_and_policy(thread_id,
ThreadPriority::Min,
ThreadSchedulePolicy::Normal(NormalThreadSchedulePolicy::Normal)).is_ok());