Skip to content

Commit

Permalink
thread: fix std thread pin
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdroychan committed Jul 25, 2024
1 parent d8f414b commit ba2f15d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,7 @@ impl Thread for DefaultThread {
}

fn pin(&self, core: usize) {
let nr_cores = core_affinity::get_core_ids().unwrap().len();
core_affinity::set_for_current(core_affinity::CoreId {
id: core % nr_cores,
});
let cores = core_affinity::get_core_ids().unwrap();
core_affinity::set_for_current(cores[core % cores.len()]);
}
}

0 comments on commit ba2f15d

Please sign in to comment.