Skip to content

Commit

Permalink
Miri can set thread names now (bevyengine#5108)
Browse files Browse the repository at this point in the history
# Objective

rust-lang/miri#1717 has been fixed so we can set thread names in Miri now.

## Solution

We set thread names in Miri.
  • Loading branch information
RalfJung authored and inodentry committed Aug 8, 2022
1 parent 72fab84 commit 31c4e32
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions crates/bevy_tasks/src/task_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,12 @@ impl TaskPool {
let ex = Arc::clone(&executor);
let shutdown_rx = shutdown_rx.clone();

// miri does not support setting thread names
// TODO: change back when https:/rust-lang/miri/issues/1717 is fixed
#[cfg(not(miri))]
let mut thread_builder = {
let thread_name = if let Some(thread_name) = thread_name {
format!("{} ({})", thread_name, i)
} else {
format!("TaskPool ({})", i)
};
thread::Builder::new().name(thread_name)
};
#[cfg(miri)]
let mut thread_builder = {
let _ = i;
let _ = thread_name;
thread::Builder::new()
let thread_name = if let Some(thread_name) = thread_name {
format!("{} ({})", thread_name, i)
} else {
format!("TaskPool ({})", i)
};
let mut thread_builder = thread::Builder::new().name(thread_name);

if let Some(stack_size) = stack_size {
thread_builder = thread_builder.stack_size(stack_size);
Expand Down

0 comments on commit 31c4e32

Please sign in to comment.