Skip to content

Commit

Permalink
update thread_priority package
Browse files Browse the repository at this point in the history
  • Loading branch information
pyprogrammer committed Mar 28, 2024
1 parent 60e7c95 commit 3ee33d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 6 additions & 10 deletions src/shim/os_threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3ee33d7

Please sign in to comment.