Skip to content

Commit a32eac8

Browse files
committed
Miri can set thread names now (#5108)
# Objective rust-lang/miri#1717 has been fixed so we can set thread names in Miri now. ## Solution We set thread names in Miri.
1 parent e57abc1 commit a32eac8

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

crates/bevy_tasks/src/task_pool.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,12 @@ impl TaskPool {
102102
let ex = Arc::clone(&executor);
103103
let shutdown_rx = shutdown_rx.clone();
104104

105-
// miri does not support setting thread names
106-
// TODO: change back when https://github.com/rust-lang/miri/issues/1717 is fixed
107-
#[cfg(not(miri))]
108-
let mut thread_builder = {
109-
let thread_name = if let Some(thread_name) = thread_name {
110-
format!("{} ({})", thread_name, i)
111-
} else {
112-
format!("TaskPool ({})", i)
113-
};
114-
thread::Builder::new().name(thread_name)
115-
};
116-
#[cfg(miri)]
117-
let mut thread_builder = {
118-
let _ = i;
119-
let _ = thread_name;
120-
thread::Builder::new()
105+
let thread_name = if let Some(thread_name) = thread_name {
106+
format!("{} ({})", thread_name, i)
107+
} else {
108+
format!("TaskPool ({})", i)
121109
};
110+
let mut thread_builder = thread::Builder::new().name(thread_name);
122111

123112
if let Some(stack_size) = stack_size {
124113
thread_builder = thread_builder.stack_size(stack_size);

0 commit comments

Comments
 (0)