mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
runtime: add cfg for loom specific code (#6694)
This commit is contained in:
parent
1be8a8e691
commit
3ad5b6df1a
@ -264,8 +264,12 @@ impl BlockingPool {
|
|||||||
|
|
||||||
// Loom requires that execution be deterministic, so sort by thread ID before joining.
|
// Loom requires that execution be deterministic, so sort by thread ID before joining.
|
||||||
// (HashMaps use a randomly-seeded hash function, so the order is nondeterministic)
|
// (HashMaps use a randomly-seeded hash function, so the order is nondeterministic)
|
||||||
let mut workers: Vec<(usize, thread::JoinHandle<()>)> = workers.into_iter().collect();
|
#[cfg(loom)]
|
||||||
|
let workers: Vec<(usize, thread::JoinHandle<()>)> = {
|
||||||
|
let mut workers: Vec<_> = workers.into_iter().collect();
|
||||||
workers.sort_by_key(|(id, _)| *id);
|
workers.sort_by_key(|(id, _)| *id);
|
||||||
|
workers
|
||||||
|
};
|
||||||
|
|
||||||
for (_id, handle) in workers {
|
for (_id, handle) in workers {
|
||||||
let _ = handle.join();
|
let _ = handle.join();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user