1 pub const MAX_NICE: i32 = 20; 2 pub const MIN_NICE: i32 = -20; 3 pub const NICE_WIDTH: i32 = MAX_NICE - MIN_NICE + 1; 4 5 pub const MAX_RT_PRIO: i32 = 100; 6 pub const MAX_PRIO: i32 = MAX_RT_PRIO + NICE_WIDTH; 7 #[allow(dead_code)] 8 pub const DEFAULT_PRIO: i32 = MAX_RT_PRIO + NICE_WIDTH / 2; 9 10 pub const MAX_DL_PRIO: i32 = 0; 11 pub struct PrioUtil; 12 #[allow(dead_code)] 13 impl PrioUtil { 14 #[inline] 15 pub fn nice_to_prio(nice: i32) -> i32 { 16 nice + DEFAULT_PRIO 17 } 18 19 #[inline] 20 pub fn prio_to_nice(prio: i32) -> i32 { 21 prio - DEFAULT_PRIO 22 } 23 24 #[inline] 25 pub fn dl_prio(prio: i32) -> bool { 26 return prio < MAX_DL_PRIO; 27 } 28 29 #[inline] 30 pub fn rt_prio(prio: i32) -> bool { 31 return prio < MAX_RT_PRIO; 32 } 33 } 34