diff options
author | hozan23 <hozan23@karyontech.net> | 2024-06-29 21:16:46 +0200 |
---|---|---|
committer | hozan23 <hozan23@karyontech.net> | 2024-06-29 21:16:46 +0200 |
commit | 5c0abab1b7bf0f2858c451d6f0efc7ca0e138fc6 (patch) | |
tree | 9d64a261ddd289560365b71f5d02d31df6c4a0ec /core/src/async_runtime | |
parent | bcc6721257889f85f57af1b40351540585ffd41d (diff) |
use shadown variables to name clones and place them between {} when spawning new tasks
Diffstat (limited to 'core/src/async_runtime')
-rw-r--r-- | core/src/async_runtime/executor.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/core/src/async_runtime/executor.rs b/core/src/async_runtime/executor.rs index 88f6370..e0b707b 100644 --- a/core/src/async_runtime/executor.rs +++ b/core/src/async_runtime/executor.rs @@ -59,11 +59,13 @@ pub fn global_executor() -> Executor { #[cfg(feature = "tokio")] fn init_executor() -> Executor { let ex = Arc::new(tokio::runtime::Runtime::new().expect("cannot build tokio runtime")); - let ex_cloned = ex.clone(); thread::Builder::new() .name("tokio-executor".to_string()) - .spawn(move || { - catch_unwind(|| ex_cloned.block_on(std::future::pending::<()>())).ok(); + .spawn({ + let ex = ex.clone(); + move || { + catch_unwind(|| ex.block_on(std::future::pending::<()>())).ok(); + } }) .expect("cannot spawn tokio runtime thread"); Executor { inner: ex } |