pub fn set_thread_schedule_policy(
    native: ThreadId,
    policy: ThreadSchedulePolicy,
    params: ScheduleParams,
    priority: ThreadPriority
) -> Result<(), Error>
Expand description

Sets thread schedule policy.

  • May require privileges
  • Deadline policy requires a tid, not a pthread_t, so invoking this while using a deadline policy will interpret the given ThreadId as a pid_t (thread tid).

Usage

use thread_priority::*;

let thread_id = thread_native_id();
let policy = ThreadSchedulePolicy::Realtime(RealtimeThreadSchedulePolicy::Fifo);
let params = ScheduleParams { sched_priority: 3 as libc::c_int };
let priority = ThreadPriority::Min;
assert!(set_thread_schedule_policy(thread_id, policy, params, priority).is_ok());