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] nice_to_prio(nice: i32) -> i3215 pub fn nice_to_prio(nice: i32) -> i32 { 16 nice + DEFAULT_PRIO 17 } 18 19 #[inline] prio_to_nice(prio: i32) -> i3220 pub fn prio_to_nice(prio: i32) -> i32 { 21 prio - DEFAULT_PRIO 22 } 23 24 #[inline] dl_prio(prio: i32) -> bool25 pub fn dl_prio(prio: i32) -> bool { 26 return prio < MAX_DL_PRIO; 27 } 28 29 #[inline] rt_prio(prio: i32) -> bool30 pub fn rt_prio(prio: i32) -> bool { 31 return prio < MAX_RT_PRIO; 32 } 33 } 34