This commit is contained in:
Carl Lerche
2023-06-26 18:40:57 +00:00
parent 8c2fcf727d
commit ebc978eb51
2 changed files with 6 additions and 7 deletions
@@ -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();
+4 -5
View File
@@ -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<AtomicBool>,
@@ -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<Inner>);
struct Inner {
core: TryLock<Core>,
core: Mutex<Core>,
owned: OwnedTasks<Runtime>,
}
@@ -264,7 +263,7 @@ struct Core {
queue: VecDeque<task::Notified<Runtime>>,
}
static CURRENT: TryLock<Option<Runtime>> = TryLock::new(None);
static CURRENT: Mutex<Option<Runtime>> = Mutex::new(None);
impl Runtime {
fn spawn<T>(&self, future: T) -> JoinHandle<T::Output>