diff --git a/tokio/src/runtime/scheduler/multi_thread/worker.rs b/tokio/src/runtime/scheduler/multi_thread/worker.rs index a026d42e4..4209a9f36 100644 --- a/tokio/src/runtime/scheduler/multi_thread/worker.rs +++ b/tokio/src/runtime/scheduler/multi_thread/worker.rs @@ -835,7 +835,7 @@ impl Worker { return Ok((None, core)); } - // core = try_task_new_batch!(self, self.poll_driver(cx, core)); + // core = try_task!(self, self.poll_driver(cx, core)); // Get a snapshot of which workers are idle cx.shared().idle.snapshot(&mut self.idle_snapshot); @@ -850,7 +850,7 @@ impl Worker { return Ok((Some(task), core)); } - core = try_task_new_batch!(self, self.next_remote_task_batch(cx, core)); + core = try_task!(self.next_remote_task_batch(cx, core)); if i > 0 { super::counters::inc_num_spin_stall(); diff --git a/tokio/src/runtime/tests/task.rs b/tokio/src/runtime/tests/task.rs index a79c0f50d..0485bba7a 100644 --- a/tokio/src/runtime/tests/task.rs +++ b/tokio/src/runtime/tests/task.rs @@ -1,11 +1,10 @@ use crate::runtime::task::{self, unowned, Id, JoinHandle, OwnedTasks, Schedule, Task}; use crate::runtime::tests::NoopSchedule; -use crate::util::TryLock; use std::collections::VecDeque; use std::future::Future; use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::Arc; +use std::sync::{Arc, Mutex}; struct AssertDropHandle { is_dropped: Arc, @@ -243,7 +242,7 @@ fn with(f: impl FnOnce(Runtime)) { let rt = Runtime(Arc::new(Inner { owned: OwnedTasks::new(), - core: TryLock::new(Core { + core: Mutex::new(Core { queue: VecDeque::new(), }), })); @@ -256,7 +255,7 @@ fn with(f: impl FnOnce(Runtime)) { struct Runtime(Arc); struct Inner { - core: TryLock, + core: Mutex, owned: OwnedTasks, } @@ -264,7 +263,7 @@ struct Core { queue: VecDeque>, } -static CURRENT: TryLock> = TryLock::new(None); +static CURRENT: Mutex> = Mutex::new(None); impl Runtime { fn spawn(&self, future: T) -> JoinHandle