Skip to content

Commit

Permalink
fixup! spawn_mandatory_blocking: fix race with shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
BraulioVM committed Jan 24, 2022
1 parent 75f487f commit f96fa96
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tokio/src/runtime/tests/loom_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fn spawn_mandatory_blocking_should_run_even_when_shutting_down_from_other_thread
use crate::runtime::tests::loom_oneshot;
loom::model(|| {
let rt = runtime::Builder::new_current_thread().build().unwrap();
let _enter = rt.enter();
let handle = rt.handle().clone();

// Drop the runtime in a different thread
{
Expand All @@ -58,6 +58,7 @@ fn spawn_mandatory_blocking_should_run_even_when_shutting_down_from_other_thread
});
}

let _enter = handle.enter();
let (tx, rx) = loom_oneshot::channel();
let handle = runtime::spawn_mandatory_blocking(move || {
let _ = tx.send(());
Expand Down

0 comments on commit f96fa96

Please sign in to comment.