mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
Get rid of Enter for with_default (#1315)
We want executors to enforce that there are never multiple active at the same time. This is ensured through `Enter`, which will panic if you attempt to create more than one. However, by requiring you to pass an `&mut Enter` to `executor::with_default`, we were *also* disallowing temporarily overriding the current executor. This patch removes that requirement.
This commit is contained in:
@@ -119,11 +119,11 @@ impl Worker {
|
||||
let mut sender = Sender { pool };
|
||||
|
||||
// Enter an execution context
|
||||
let mut enter = tokio_executor::enter().unwrap();
|
||||
let _enter = tokio_executor::enter().unwrap();
|
||||
|
||||
tokio_executor::with_default(&mut sender, &mut enter, |enter| {
|
||||
tokio_executor::with_default(&mut sender, || {
|
||||
if let Some(ref callback) = self.pool.config.around_worker {
|
||||
callback.call(self, enter);
|
||||
callback.call(self);
|
||||
} else {
|
||||
self.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user