diff --git a/Cargo.toml b/Cargo.toml index 67b4fbf..000f7d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ petgraph = "0.6.3" rustc-hash = "1.1.0" # For running different thread priorities and enabling FIFO Execution -thread-priority = "0.13.1" +thread-priority = "0.15" thiserror = "1.0.49" graphviz-rust = { version = "0.6.6", optional = true } derive_builder = "0.12.0" diff --git a/src/shim/os_threads.rs b/src/shim/os_threads.rs index a88de57..175aee8 100644 --- a/src/shim/os_threads.rs +++ b/src/shim/os_threads.rs @@ -27,22 +27,18 @@ pub enum RunMode { /// Constructs a thread builder based on the options specified in the [RunMode] pub fn make_builder(mode: super::RunMode) -> Builder { - let (priority, policy) = match mode { - super::RunMode::Simple => ( - thread_priority::get_current_thread_priority().unwrap(), - thread_priority::thread_schedule_policy().unwrap(), - ), + match mode { + super::RunMode::Simple => thread_priority::ThreadBuilder::default(), super::RunMode::FIFO => { let priority = thread_priority::ThreadPriority::Crossplatform(10u8.try_into().unwrap()); let policy = thread_priority::unix::ThreadSchedulePolicy::Realtime( thread_priority::RealtimeThreadSchedulePolicy::Fifo, ); - (priority, policy) + thread_priority::ThreadBuilder::default() + .priority(priority) + .policy(policy) } - }; - thread_priority::ThreadBuilder::default() - .priority(priority) - .policy(policy) + } } /// Spawns a coroutine, without the builder because