Skip to content

Commit

Permalink
Panicking in spawned Rayon tasks will abort the process by default. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold committed Jun 4, 2024
1 parent b960e40 commit 8151925
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,26 @@ mod tests {
let (tx, rx) = crossbeam_channel::bounded::<()>(0);
let rx = Arc::new(rx);
let executor = Executor::multi_thread(3, "search-test").unwrap();
for i in 0..1000 {
for _ in 0..1000 {
let counter_clone: Arc<AtomicU64> = counter.clone();
let other_counter_clone: Arc<AtomicU64> = other_counter.clone();

let rx_clone = rx.clone();
let rx_clone2 = rx.clone();
let fut = executor.spawn_blocking(move || {
counter_clone.fetch_add(1, Ordering::SeqCst);
let () = rx_clone.recv().unwrap();
let _ = rx_clone.recv();
});
futures.push(fut);
let other_fut = executor.spawn_blocking(move || {
other_counter_clone.fetch_add(1, Ordering::SeqCst);
let () = rx_clone2.recv().unwrap();
let _ = rx_clone2.recv();
});
other_futures.push(other_fut);
}

// We execute 100 futures.
for i in 0..100 {
for _ in 0..100 {
tx.send(()).unwrap();
}

Expand All @@ -226,7 +226,7 @@ mod tests {
drop(other_futures);

// We execute 100 futures.
for i in 0..100 {
for _ in 0..100 {
tx.send(()).unwrap();
}

Expand Down

0 comments on commit 8151925

Please sign in to comment.