Miri can set thread names now (#5108)

# Objective

https://github.com/rust-lang/miri/issues/1717 has been fixed so we can set thread names in Miri now.

## Solution

We set thread names in Miri.
This commit is contained in:
Ralf Jung 2022-06-26 21:28:00 +00:00
parent e57abc1c42
commit a32eac825a

View File

@ -102,23 +102,12 @@ impl TaskPool {
let ex = Arc::clone(&executor); let ex = Arc::clone(&executor);
let shutdown_rx = shutdown_rx.clone(); let shutdown_rx = shutdown_rx.clone();
// miri does not support setting thread names
// TODO: change back when https://github.com/rust-lang/miri/issues/1717 is fixed
#[cfg(not(miri))]
let mut thread_builder = {
let thread_name = if let Some(thread_name) = thread_name { let thread_name = if let Some(thread_name) = thread_name {
format!("{} ({})", thread_name, i) format!("{} ({})", thread_name, i)
} else { } else {
format!("TaskPool ({})", i) format!("TaskPool ({})", i)
}; };
thread::Builder::new().name(thread_name) let mut thread_builder = thread::Builder::new().name(thread_name);
};
#[cfg(miri)]
let mut thread_builder = {
let _ = i;
let _ = thread_name;
thread::Builder::new()
};
if let Some(stack_size) = stack_size { if let Some(stack_size) = stack_size {
thread_builder = thread_builder.stack_size(stack_size); thread_builder = thread_builder.stack_size(stack_size);