[][src]Function thread_priority::set_thread_priority

pub fn set_thread_priority(
    native: pthread_t,
    priority: ThreadPriority,
    policy: ThreadSchedulePolicy
) -> Result<(), Error>

Sets thread's priority and schedule policy

  • May require privileges

Usage

Setting thread priority to minimum with normal schedule policy:

extern crate thread_priority;
use thread_priority::*;

fn main() {
    let thread_id = thread_native_id();
    assert!(set_thread_priority(thread_id,
                                ThreadPriority::Min,
                                ThreadSchedulePolicy::Normal(NormalThreadSchedulePolicy::Normal)).is_ok());
}