id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:21
// Push the rest of the on the run queue self.run_queue.push_back(tasks); ret } } fn next_local_task(&mut self) -> Option<Notified> { self.lifo_slot.take().or_else(|| self.run_queue.pop()) } /// Function responsible for stealing tasks from another worker //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
801
860
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:22
} // Fallback on checking the global queue worker.handle.next_remote_task() } fn transition_to_searching(&mut self, worker: &Worker) -> bool { if !self.is_searching { self.is_searching = worker.handle.shared.idle.transition_worker_to_searching(); } self.is_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
841
900
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:23
// Workers should not park if they have work to do if self.has_tasks() || self.is_traced { return false; } // When the final worker transitions **out** of searching to parked, it // must check all the queues one last time in case work materialized // between the last...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
881
940
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
} if worker .handle .shared .idle .is_parked(&worker.handle.shared, worker.index) { return false; } // When unparked, the worker is in the searching state. self.is_searching = true; true } /// Runs mai...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
// Signal to all tasks to shut down. worker .handle .shared .owned .close_and_shutdown_all(start as usize); self.stats .submit(&worker.handle.shared.worker_metrics[worker.index]); } /// Shuts down the core. fn shutdown(&mut self, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
// TODO: Move `Handle` impls into handle.rs impl task::Schedule for Arc<Handle> { fn release(&self, task: &Task) -> Option<Task> { self.shared.owned.remove(task) } fn schedule(&self, task: Notified) { self.schedule_task(task, false); } fn yield_now(&self, task: Notified) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
} fn schedule_local(&self, core: &mut Core, task: Notified, is_yield: bool) { core.stats.inc_local_schedule_count(); // Spawning from the worker thread. If scheduling a "yield" then the // task must always be pushed to the back of the queue, enabling other // tasks to be executed. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
let mut synced = self.shared.synced.lock(); // safety: passing in correct `idle::Synced` unsafe { self.shared.inject.pop(&mut synced.inject) } } fn push_remote_task(&self, task: Notified) { self.shared.scheduler_metrics.inc_remote_schedule_count(); let mut synced = self.shared....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
debug_assert!(self.shared.owned.is_empty()); for mut core in cores.drain(..) { core.shutdown(self); } // Drain the injection queue // // We already shut down every task, so we can simply drop the tasks. while let Some(task) = self.next_remote_task() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
&mut self.lock.inject } } impl<'a> Lock<inject::Synced> for &'a Handle { type Handle = InjectGuard<'a>; fn lock(self) -> Self::Handle { InjectGuard { lock: self.shared.synced.lock(), } } } #[track_caller] fn with_current<R>(f: impl FnOnce(Option<&Context>) -> R) -> R { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,232
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
// Signal to all tasks to shut down. worker .handle .shared .owned .close_and_shutdown_all(start as usize); self.stats .submit(&worker.handle.shared.worker_metrics[worker.index]); } /// Shuts down the core. fn shutdown(&mut self, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
} } // TODO: Move `Handle` impls into handle.rs impl task::Schedule for Arc<Handle> { fn release(&self, task: &Task) -> Option<Task> { self.shared.owned.remove(task) } fn schedule(&self, task: Notified) { self.schedule_task(task, false); } fn yield_now(&self, task: Notified) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
self.schedule_task(task, false); } } fn schedule_local(&self, core: &mut Core, task: Notified, is_yield: bool) { core.stats.inc_local_schedule_count(); // Spawning from the worker thread. If scheduling a "yield" then the // task must always be pushed to the back of the queue, e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
return None; } let mut synced = self.shared.synced.lock(); // safety: passing in correct `idle::Synced` unsafe { self.shared.inject.pop(&mut synced.inject) } } fn push_remote_task(&self, task: Notified) { self.shared.scheduler_metrics.inc_remote_schedule_count(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
} } pub(super) fn notify_all(&self) { for remote in &self.shared.remotes[..] { remote.unpark.unpark(&self.driver); } } fn notify_if_work_pending(&self) { for remote in &self.shared.remotes[..] { if !remote.steal.is_empty() { self.notify_p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
} debug_assert!(self.shared.owned.is_empty()); for mut core in cores.drain(..) { core.shutdown(self); } // Drain the injection queue // // We already shut down every task, so we can simply drop the tasks. while let Some(task) = self.next_remote_task...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
impl<'a> AsMut<inject::Synced> for InjectGuard<'a> { fn as_mut(&mut self) -> &mut inject::Synced { &mut self.lock.inject } } impl<'a> Lock<inject::Synced> for &'a Handle { type Handle = InjectGuard<'a>; fn lock(self) -> Self::Handle { InjectGuard { lock: self.shared.synced....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,234
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:2
//! inject queue. //! //! The first case can only happen if the OwnedTasks::bind call happens before //! or during step 1 of shutdown. In this case, the runtime will clean up the //! task in step 3 of shutdown. //! //! In the latter case, the task was not spawned and the task is immediately //! cancelled by the spaw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/multi_thread/worker.rs
41
100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:5
pub(crate) owned: OwnedTasks<Arc<Handle>>, /// Data synchronized by the scheduler mutex pub(super) synced: Mutex<Synced>, /// Cores that have observed the shutdown signal /// /// The core is **not** placed back in the worker to avoid it from being /// stolen by a thread that was spawned as par...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/multi_thread/worker.rs
161
220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:6
struct Remote { /// Steals tasks from this worker. pub(super) steal: queue::Steal<Arc<Handle>>, /// Unparks the associated worker thread unpark: Unparker, } /// Thread-local context pub(crate) struct Context { /// Worker worker: Arc<Worker>, /// Core data core: RefCell<Option<Box<Core...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/multi_thread/worker.rs
201
260
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:17
}) } fn reset_lifo_enabled(&self, core: &mut Core) { core.lifo_enabled = !self.worker.handle.shared.config.disable_lifo_slot; } fn assert_lifo_enabled_is_correct(&self, core: &Core) { debug_assert_eq!( core.lifo_enabled, !self.worker.handle.shared.config.disable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/multi_thread/worker.rs
641
700
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:7
pub(super) fn create( size: usize, park: Parker, driver_handle: driver::Handle, blocking_spawner: blocking::Spawner, seed_generator: RngSeedGenerator, config: Config, ) -> (Arc<Handle>, Launch) { let mut cores = Vec::with_capacity(size); let mut remotes = Vec::with_capacity(size); le...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
241
300
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:8
let (idle, idle_synced) = Idle::new(size); let (inject, inject_synced) = inject::Shared::new(); let remotes_len = remotes.len(); let handle = Arc::new(Handle { shared: Shared { remotes: remotes.into_boxed_slice(), inject, idle, owned: OwnedTasks::new(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
281
340
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:17
} }) } fn reset_lifo_enabled(&self, core: &mut Core) { core.lifo_enabled = !self.worker.handle.shared.config.disable_lifo_slot; } fn assert_lifo_enabled_is_correct(&self, core: &Core) { debug_assert_eq!( core.lifo_enabled, !self.worker.handle.shared.conf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
641
700
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:18
/// in its own local queue until the queue saturates (ntasks > LOCAL_QUEUE_CAPACITY). /// When the local queue is saturated, the overflow tasks are added to the injection queue /// from where other workers can pick them up. /// Also, we rely on the workstealing algorithm to spread the tasks amongst workers ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
681
740
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
return true; } if worker .handle .shared .idle .is_parked(&worker.handle.shared, worker.index) { return false; } // When unparked, the worker is in the searching state. self.is_searching = true; true ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
self.stats .submit(&worker.handle.shared.worker_metrics[worker.index]); } /// Shuts down the core. fn shutdown(&mut self, handle: &Handle) { // Take the core let mut park = self.park.take().expect("park missing"); // Drain the queue while self.next_local_task()....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
} fn schedule(&self, task: Notified) { self.schedule_task(task, false); } fn yield_now(&self, task: Notified) { self.schedule_task(task, true); } } impl Handle { pub(super) fn schedule_task(&self, task: Notified, is_yield: bool) { with_current(|maybe_cx| { if l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
// Spawning from the worker thread. If scheduling a "yield" then the // task must always be pushed to the back of the queue, enabling other // tasks to be executed. If **not** a yield, then there is more // flexibility and the task may go to the front of the queue. let should_notify = if...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
fn push_remote_task(&self, task: Notified) { self.shared.scheduler_metrics.inc_remote_schedule_count(); let mut synced = self.shared.synced.lock(); // safety: passing in correct `idle::Synced` unsafe { self.shared.inject.push(&mut synced.inject, task); } } p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
} fn notify_if_work_pending(&self) { for remote in &self.shared.remotes[..] { if !remote.steal.is_empty() { self.notify_parked_local(); return; } } if !self.shared.inject.is_empty() { self.notify_parked_local(); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
// Drain the injection queue // // We already shut down every task, so we can simply drop the tasks. while let Some(task) = self.next_remote_task() { drop(task); } } fn ptr_eq(&self, other: &Handle) -> bool { std::ptr::eq(self, other) } } impl Overflow<A...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
type Handle = InjectGuard<'a>; fn lock(self) -> Self::Handle { InjectGuard { lock: self.shared.synced.lock(), } } } #[track_caller] fn with_current<R>(f: impl FnOnce(Option<&Context>) -> R) -> R { use scheduler::Context::MultiThread; context::with_scheduler(|ctx| match ctx...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
340d4e5238f7feaee63978c541559e0a127733bf
github
async-runtime
https://github.com/tokio-rs/tokio/blob/340d4e5238f7feaee63978c541559e0a127733bf/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,227
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
.next_remote_task() .or_else(|| self.next_local_task()) } else { let maybe_task = self.next_local_task(); if maybe_task.is_some() { return maybe_task; } if worker.inject().is_empty() { return None; } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
8ec3e0d94d624d1be86afabc9594e2276500412f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8ec3e0d94d624d1be86afabc9594e2276500412f/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:14
// Run maintenance, if needed core = self.maintenance(core); // First, check work available to the current worker. if let Some(task) = core.next_task(&self.worker) { core = self.run_task(task, core)?; continue; } // We consume...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
521
580
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
.or_else(|| self.next_local_task()) } else { let maybe_task = self.next_local_task(); if maybe_task.is_some() { return maybe_task; } if worker.inject().is_empty() { return None; } // Other threads can only...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
} if worker .handle .shared .idle .is_parked(&worker.handle.shared, worker.index) { return false; } // When unparked, the worker is in the searching state. self.is_searching = true; true } /// Runs mai...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
.submit(&worker.handle.shared.worker_metrics[worker.index]); } /// Shuts down the core. fn shutdown(&mut self, handle: &Handle) { // Take the core let mut park = self.park.take().expect("park missing"); // Drain the queue while self.next_local_task().is_some() {} p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
fn schedule(&self, task: Notified) { self.schedule_task(task, false); } fn yield_now(&self, task: Notified) { self.schedule_task(task, true); } } impl Handle { pub(super) fn schedule_task(&self, task: Notified, is_yield: bool) { with_current(|maybe_cx| { if let Some...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
// task must always be pushed to the back of the queue, enabling other // tasks to be executed. If **not** a yield, then there is more // flexibility and the task may go to the front of the queue. let should_notify = if is_yield || !core.lifo_enabled { core.run_queue ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
fn push_remote_task(&self, task: Notified) { self.shared.scheduler_metrics.inc_remote_schedule_count(); let mut synced = self.shared.synced.lock(); // safety: passing in correct `idle::Synced` unsafe { self.shared.inject.push(&mut synced.inject, task); } } p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
fn notify_if_work_pending(&self) { for remote in &self.shared.remotes[..] { if !remote.steal.is_empty() { self.notify_parked_local(); return; } } if !self.shared.inject.is_empty() { self.notify_parked_local(); } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
// Drain the injection queue // // We already shut down every task, so we can simply drop the tasks. while let Some(task) = self.next_remote_task() { drop(task); } } fn ptr_eq(&self, other: &Handle) -> bool { std::ptr::eq(self, other) } } impl Overflow<A...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
fn lock(self) -> Self::Handle { InjectGuard { lock: self.shared.synced.lock(), } } } #[track_caller] fn with_current<R>(f: impl FnOnce(Option<&Context>) -> R) -> R { use scheduler::Context::MultiThread; context::with_scheduler(|ctx| match ctx { Some(MultiThread(ctx)) =>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
593dbf55d1165df9d27f81b1214eecacbb7f94dc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/593dbf55d1165df9d27f81b1214eecacbb7f94dc/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,226
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
.or_else(|| self.next_local_task()) } else { let maybe_task = self.next_local_task(); if maybe_task.is_some() { return maybe_task; } if worker.inject().is_empty() { return None; } // Other threads can only...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
fn schedule(&self, task: Notified) { self.schedule_task(task, false); } fn yield_now(&self, task: Notified) { self.schedule_task(task, true); } } impl Handle { pub(super) fn schedule_task(&self, task: Notified, is_yield: bool) { with_current(|maybe_cx| { if let Some...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
7c54fdce3e68566e346b7999ef1ff98bb1977bab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c54fdce3e68566e346b7999ef1ff98bb1977bab/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
.or_else(|| self.next_local_task()) } else { let maybe_task = self.next_local_task(); if maybe_task.is_some() { return maybe_task; } if worker.inject().is_empty() { return None; } // Other threads can only...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:21
} } fn next_local_task(&mut self) -> Option<Notified> { self.lifo_slot.take().or_else(|| self.run_queue.pop()) } /// Function responsible for stealing tasks from another worker /// /// Note: Only if less than half the workers are searching for tasks to steal /// a new worker will a...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
801
860
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:22
} fn transition_to_searching(&mut self, worker: &Worker) -> bool { if !self.is_searching { self.is_searching = worker.handle.shared.idle.transition_worker_to_searching(); } self.is_searching } fn transition_from_searching(&mut self, worker: &Worker) { if !self....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
841
900
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
.shared .idle .is_parked(&worker.handle.shared, worker.index) { return false; } // When unparked, the worker is in the searching state. self.is_searching = true; true } /// Runs maintenance work such as checking the pool's state. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
fn shutdown(&mut self, handle: &Handle) { // Take the core let mut park = self.park.take().expect("park missing"); // Drain the queue while self.next_local_task().is_some() {} park.shutdown(&handle.driver); } fn tune_global_queue_interval(&mut self, worker: &Worker) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
fn yield_now(&self, task: Notified) { self.schedule_task(task, true); } } impl Handle { pub(super) fn schedule_task(&self, task: Notified, is_yield: bool) { with_current(|maybe_cx| { if let Some(cx) = maybe_cx { // Make sure the task is part of the **current** schedu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
core.run_queue .push_back_or_overflow(task, self, &mut core.stats); true } else { // Push to the LIFO slot let prev = core.lifo_slot.take(); let ret = prev.is_some(); if let Some(prev) = prev { core.run_queue ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
// safety: passing in correct `idle::Synced` unsafe { self.shared.inject.push(&mut synced.inject, task); } } pub(super) fn close(&self) { if self .shared .inject .close(&mut self.shared.synced.lock().inject) { self.noti...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
self.notify_parked_local(); return; } } if !self.shared.inject.is_empty() { self.notify_parked_local(); } } fn transition_worker_from_searching(&self) { if self.shared.idle.transition_worker_from_searching() { // We are the fi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
drop(task); } } fn ptr_eq(&self, other: &Handle) -> bool { std::ptr::eq(self, other) } } impl Overflow<Arc<Handle>> for Handle { fn push(&self, task: task::Notified<Arc<Handle>>) { self.push_remote_task(task); } fn push_batch<I>(&self, iter: I) where I: Ite...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
} } } #[track_caller] fn with_current<R>(f: impl FnOnce(Option<&Context>) -> R) -> R { use scheduler::Context::MultiThread; context::with_scheduler(|ctx| match ctx { Some(MultiThread(ctx)) => f(Some(ctx)), _ => f(None), }) } // `u32::abs_diff` is not available on Tokio's MSRV. fn abs_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
63577cd8d3f2b1a1c787870125ab808eaa1eaa99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/63577cd8d3f2b1a1c787870125ab808eaa1eaa99/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,222
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:4
/// involves attempting to steal from other workers. is_searching: bool, /// True if the scheduler is being shutdown is_shutdown: bool, /// True if the scheduler is being traced is_traced: bool, /// Parker /// /// Stored in an `Option` as the parker is added / removed to make the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/scheduler/multi_thread/worker.rs
121
180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:5
pub(super) owned: OwnedTasks<Arc<Handle>>, /// Data synchronized by the scheduler mutex pub(super) synced: Mutex<Synced>, /// Cores that have observed the shutdown signal /// /// The core is **not** placed back in the worker to avoid it from being /// stolen by a thread that was spawned as par...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
304d14036184c9c65d88706e48dacb57bb172fcc
github
async-runtime
https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/runtime/scheduler/multi_thread/worker.rs
161
220
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
fn yield_now(&self, task: Notified) { self.schedule_task(task, true); } } impl Handle { pub(super) fn schedule_task(&self, task: Notified, is_yield: bool) { with_current(|maybe_cx| { if let Some(cx) = maybe_cx { // Make sure the task is part of the **current** schedu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
let ret = prev.is_some(); if let Some(prev) = prev { core.run_queue .push_back_or_overflow(prev, self, &mut core.stats); } core.lifo_slot = Some(task); ret }; // Only notify if not currently parked. If `park` is `Non...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
pub(super) fn close(&self) { if self .shared .inject .close(&mut self.shared.synced.lock().inject) { self.notify_all(); } } fn notify_parked_local(&self) { super::counters::inc_num_inc_notify_local(); if let Some(index) = ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
self.notify_parked_local(); } } fn transition_worker_from_searching(&self) { if self.shared.idle.transition_worker_from_searching() { // We are the final searching worker. Because work was found, we // need to notify another worker. self.notify_parked_local()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
} } impl Overflow<Arc<Handle>> for Handle { fn push(&self, task: task::Notified<Arc<Handle>>) { self.push_remote_task(task); } fn push_batch<I>(&self, iter: I) where I: Iterator<Item = task::Notified<Arc<Handle>>>, { unsafe { self.shared.inject.push_batch(self, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,216
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:31
use scheduler::Context::MultiThread; context::with_scheduler(|ctx| match ctx { Some(MultiThread(ctx)) => f(Some(ctx)), _ => f(None), }) } // `u32::abs_diff` is not available on Tokio's MSRV. fn abs_diff(a: u32, b: u32) -> u32 { if a > b { a - b } else { b - a } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
6e990eb2c814d7f327b773714d6ea6982fdd9b9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6e990eb2c814d7f327b773714d6ea6982fdd9b9c/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,201
1,216
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:8
let (idle, idle_synced) = Idle::new(size); let (inject, inject_synced) = inject::Shared::new(); let remotes_len = remotes.len(); let handle = Arc::new(Handle { shared: Shared { remotes: remotes.into_boxed_slice(), inject, idle, owned: OwnedTasks::new(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
281
340
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:9
pub(crate) fn block_in_place<F, R>(f: F) -> R where F: FnOnce() -> R, { // Try to steal the worker core back struct Reset(coop::Budget); impl Drop for Reset { fn drop(&mut self) { with_current(|maybe_cx| { if let Some(cx) = maybe_cx { let core = c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
321
380
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:10
false, ) => { // We are on an executor, but _not_ on the thread pool. That is // _only_ okay if we are in a thread pool runtime's block_on // method: if allow_block_in_place { had_entered = true; return ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
361
420
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:11
// execution. // // First, move the core back into the worker's shared core slot. cx.worker.core.set(core); // Next, clone the worker handle and send it to a new thread for // processing. // // Once the blocking task is done executing, we will attempt to ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
401
460
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:12
impl Drop for AbortOnPanic { fn drop(&mut self) { if std::thread::panicking() { eprintln!("worker thread panicking; aborting process"); std::process::abort(); } } } // Catching panics on worker threads in tests is quite tricky. Instead, wh...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
441
500
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:13
// the worker core is lost due to `block_in_place()` being called from // within the task. cx.defer.wake(); }); }); } impl Context { fn run(&self, mut core: Box<Core>) -> RunResult { // Reset `lifo_enabled` here in case the core was previously stolen from // a ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
481
540
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:14
// from other workers. if let Some(task) = core.steal_work(&self.worker) { // Found work, switch back to processing core.stats.start_processing_scheduled_tasks(); core = self.run_task(task, core)?; } else { // Wait for work ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
521
580
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:15
// Run the task coop::budget(|| { task.run(); let mut lifo_polls = 0; // As long as there is budget remaining and a task exists in the // `lifo_slot`, then keep running. loop { // Check if we still have the core. If not, the core was s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
561
620
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:16
// If we hit this point, the LIFO slot should be enabled. // There is no need to reset it. debug_assert!(core.lifo_enabled); return Ok(core); } // Track that we are about to run a task from the LIFO slot. lifo_p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
601
660
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:17
fn maintenance(&self, mut core: Box<Core>) -> Box<Core> { if core.tick % self.worker.handle.shared.config.event_interval == 0 { super::counters::inc_num_maintenance(); core.stats.end_processing_scheduled_tasks(); // Call `park` with a 0 timeout. This enables the I/O driver,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
641
700
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:18
// Run regularly scheduled maintenance core.maintenance(&self.worker); if core.transition_from_parked(&self.worker) { break; } } } if let Some(f) = &self.worker.handle.shared.config.after_unpark { f(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
681
740
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:19
if core.should_notify_others() { self.worker.handle.notify_parked_local(); } core } pub(crate) fn defer(&self, waker: &Waker) { self.defer.defer(waker); } } impl Core { /// Increment the tick fn tick(&mut self) { self.tick = self.tick.wrapping_add(1); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
721
780
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
// `run_queue`. So, we can be confident that by the time we call // `run_queue.push_back` below, there will be *at least* `cap` // available slots in the queue. let cap = usize::min( self.run_queue.remaining_slots(), self.run_queue.max_capacity() / 2, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:21
if !self.transition_to_searching(worker) { return None; } let num = worker.handle.shared.remotes.len(); // Start from a random worker let start = self.rand.fastrand_n(num as u32) as usize; for i in 0..num { let i = (start + i) % num; // Don'...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
801
860
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:22
} self.is_searching = false; worker.handle.transition_worker_from_searching(); } fn has_tasks(&self) -> bool { self.lifo_slot.is_some() || self.run_queue.has_tasks() } fn should_notify_others(&self) -> bool { // If there are tasks available to steal, but this worker is...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
841
900
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:23
if is_last_searcher { worker.handle.notify_if_work_pending(); } true } /// Returns `true` if the transition happened. fn transition_from_parked(&mut self, worker: &Worker) -> bool { // If a task is in the lifo slot/run queue, then we must unpark regardless of //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
881
940
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
fn maintenance(&mut self, worker: &Worker) { self.stats .submit(&worker.handle.shared.worker_metrics[worker.index]); if !self.is_shutdown { // Check if the scheduler has been shutdown let synced = worker.handle.shared.synced.lock(); self.is_shutdown = wor...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
.tuned_global_queue_interval(&worker.handle.shared.config); debug_assert!(next > 1); // Smooth out jitter if abs_diff(self.global_queue_interval, next) > 2 { self.global_queue_interval = next; } } } impl Worker { /// Returns a reference to the scheduler's injection...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:26
if let Some(core) = cx.core.borrow_mut().as_mut() { self.schedule_local(core, task, is_yield); return; } } } // Otherwise, use the inject queue. self.push_remote_task(task); self.notify_p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:27
// scheduling is from a resource driver. As notifications often come in // batches, the notification is delayed until the park is complete. if should_notify && core.park.is_some() { self.notify_parked_local(); } } fn next_remote_task(&self) -> Option<Notified> { if s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:28
if let Some(index) = self.shared.idle.worker_to_notify(&self.shared) { super::counters::inc_num_unparks_local(); self.shared.remotes[index].unpark.unpark(&self.driver); } } fn notify_parked_remote(&self) { if let Some(index) = self.shared.idle.worker_to_notify(&self.shar...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:29
/// its core back into its handle. /// /// If all workers have reached this point, the final cleanup is performed. fn shutdown_core(&self, core: Box<Core>) { let mut cores = self.shared.shutdown_cores.lock(); cores.push(core); if cores.len() != self.shared.remotes.len() { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:30
self.shared.inject.push_batch(self, iter); } } } pub(crate) struct InjectGuard<'a> { lock: crate::loom::sync::MutexGuard<'a, Synced>, } impl<'a> AsMut<inject::Synced> for InjectGuard<'a> { fn as_mut(&mut self) -> &mut inject::Synced { &mut self.lock.inject } } impl<'a> Lock<inject::Sy...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
848482d2bb5761cd8fab3ef0dd92b8241e75e3d7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/848482d2bb5761cd8fab3ef0dd92b8241e75e3d7/tokio/src/runtime/scheduler/multi_thread/worker.rs
1,161
1,203
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:18
// Run regularly scheduled maintenance core.maintenance(&self.worker); if core.transition_from_parked(&self.worker) { break; } } } if let Some(f) = &self.worker.handle.shared.config.after_unpark { f(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
681
740
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:19
// If there are tasks available to steal, but this worker is not // looking for tasks to steal, notify another worker. if !core.is_searching && core.run_queue.is_stealable() { self.worker.handle.notify_parked_local(); } core } pub(crate) fn defer(&self, waker: &Wake...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
721
780
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:20
// Other threads can only **remove** tasks from the current worker's // `run_queue`. So, we can be confident that by the time we call // `run_queue.push_back` below, there will be *at least* `cap` // available slots in the queue. let cap = usize::min( self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
761
820
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:21
/// workers will be trying to steal at the same time. fn steal_work(&mut self, worker: &Worker) -> Option<Notified> { if !self.transition_to_searching(worker) { return None; } let num = worker.handle.shared.remotes.len(); // Start from a random worker let start =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
801
860
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:22
if !self.is_searching { return; } self.is_searching = false; worker.handle.transition_worker_from_searching(); } /// Prepares the worker state for parking. /// /// Returns true if the transition happened, false if there is work to do first. fn transition_to_park...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
841
900
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:23
// being notified if self.lifo_slot.is_some() { // When a worker wakes, it should only transition to the "searching" // state when the wake originates from another worker *or* a new task // is pushed. We do *not* want the worker to transition to "searching" // whe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
881
940
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:24
// Check if the worker should be tracing. self.is_traced = worker.handle.shared.trace_status.trace_requested(); } } /// Signals all tasks to shut down, and waits for them to complete. Must run /// before we enter the single-threaded phase of shutdown processing. fn pre_shutdown(&mut...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
921
980
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:25
impl Worker { /// Returns a reference to the scheduler's injection queue. fn inject(&self) -> &inject::Shared<Arc<Handle>> { &self.handle.shared.inject } } // TODO: Move `Handle` impls into handle.rs impl task::Schedule for Arc<Handle> { fn release(&self, task: &Task) -> Option<Task> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1c8d22c18b4c629c2d5f44b6d599738c2fca8b8a/tokio/src/runtime/scheduler/multi_thread/worker.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:2
//! inject queue. //! //! The first case can only happen if the OwnedTasks::bind call happens before //! or during step 1 of shutdown. In this case, the runtime will clean up the //! task in step 3 of shutdown. //! //! In the latter case, the task was not spawned and the task is immediately //! cancelled by the spaw...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/scheduler/multi_thread/worker.rs
41
100
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:3
/// A scheduler worker pub(super) struct Worker { /// Reference to scheduler's handle handle: Arc<Handle>, /// Index holding this worker's remote state index: usize, /// Used to hand-off a worker's core to another thread. core: AtomicCell<Core>, } /// Core data struct Core { /// Used to s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/scheduler/multi_thread/worker.rs
81
140
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:4
/// Parker /// /// Stored in an `Option` as the parker is added / removed to make the /// borrow checker happy. park: Option<Parker>, /// Per-worker runtime stats stats: Stats, /// How often to check the global queue global_queue_interval: u32, /// Fast random number generator. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/scheduler/multi_thread/worker.rs
121
180
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread/worker.rs:5
/// stolen by a thread that was spawned as part of `block_in_place`. #[allow(clippy::vec_box)] // we're moving an already-boxed value shutdown_cores: Mutex<Vec<Box<Core>>>, /// The number of cores that have observed the trace signal. pub(super) trace_status: TraceStatus, /// Scheduler configuratio...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/scheduler/multi_thread/worker.rs
MIT
038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574
github
async-runtime
https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/scheduler/multi_thread/worker.rs
161
220