diff --git a/src/lib.rs b/src/lib.rs index dd74009..db09ae1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -246,19 +246,27 @@ impl std::error::Error for Error {} pub struct ThreadPriorityValue(u8); impl ThreadPriorityValue { /// The maximum value for a thread priority. - pub const MAX: u8 = 99; + pub const MAX: u8 = if cfg!(target_os = "vxworks") { + 255 + } else { + 99 + }; /// The minimum value for a thread priority. pub const MIN: u8 = 0; } impl std::convert::TryFrom for ThreadPriorityValue { - type Error = &'static str; + type Error = String; fn try_from(value: u8) -> Result { if (Self::MIN..=Self::MAX).contains(&value) { Ok(Self(value)) } else { - Err("The value is not in the range of [0;99]") + Err(format!( + "The value is not in the range of [{}; {}]", + Self::MIN, + Self::MAX + )) } } } diff --git a/tests/unix.rs b/tests/unix.rs index ff144c2..e699ef7 100644 --- a/tests/unix.rs +++ b/tests/unix.rs @@ -46,6 +46,7 @@ fn get_and_set_priority_with_normal_policies( #[cfg(any( target_os = "macos", target_os = "openbsd", + target_os = "vxworks", target_os = "freebsd", target_os = "netbsd" ))] @@ -107,6 +108,7 @@ fn set_priority_with_normal_policy_but_with_invalid_value(#[case] policy: Thread #[cfg(any( target_os = "macos", target_os = "openbsd", + target_os = "vxworks", target_os = "freebsd", target_os = "netbsd" ))]