diff options
author | Carl Lerche <me@carllerche.com> | 2020-10-13 15:06:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-13 15:06:22 -0700 |
commit | 00b6127f2ed3125f8b305ab4fd9bb90e99762785 (patch) | |
tree | e43ba873fed9f2cc650b6b26cfb0422aabf1a9bd /tokio/src/runtime/blocking | |
parent | a249421abc44e768217427a68f5f5e23f9d1cbd5 (diff) |
rt: switch `enter` to an RAII guard (#2954)
Diffstat (limited to 'tokio/src/runtime/blocking')
-rw-r--r-- | tokio/src/runtime/blocking/pool.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs index 2d44f896..d0f2c1c8 100644 --- a/tokio/src/runtime/blocking/pool.rs +++ b/tokio/src/runtime/blocking/pool.rs @@ -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() } |