rt: switch enter to an RAII guard (#2954)

This commit is contained in:
Carl Lerche
2020-10-13 15:06:22 -07:00
committed by GitHub
parent a249421abc
commit 00b6127f2e
11 changed files with 96 additions and 99 deletions
+3 -5
View File
@@ -232,11 +232,9 @@ impl Spawner {
builder
.spawn(move || {
// Only the reference should be moved into the closure
let rt = &rt;
rt.enter(move || {
rt.blocking_spawner.inner.run(worker_id);
drop(shutdown_tx);
})
let _enter = crate::runtime::context::enter(rt.clone());
rt.blocking_spawner.inner.run(worker_id);
drop(shutdown_tx);
})
.unwrap()
}