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/current_thread/mod.rs:4 | blocking_spawner: blocking::Spawner,
seed_generator: RngSeedGenerator,
config: Config,
) -> (CurrentThread, Arc<Handle>) {
let worker_metrics = WorkerMetrics::from_config(&config);
// Get the configured global queue interval, or use the default.
let global_queue_interval = c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:5 | }
#[track_caller]
pub(crate) fn block_on<F: Future>(&self, handle: &scheduler::Handle, future: F) -> F::Output {
pin!(future);
crate::runtime::context::enter_runtime(handle, false, |blocking| {
let handle = handle.as_current_thread();
// Attempt to steal the scheduler ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:6 | fn take_core(&self, handle: &Arc<Handle>) -> Option<CoreGuard<'_>> {
let core = self.core.take()?;
Some(CoreGuard {
context: scheduler::Context::CurrentThread(Context {
handle: handle.clone(),
core: RefCell::new(Some(core)),
defer: Defer::new(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:7 | let core = shutdown2(core, handle);
*context.core.borrow_mut() = Some(core);
}
}
}
fn shutdown2(mut core: Box<Core>, handle: &Handle) -> Box<Core> {
// Drain the OwnedTasks collection. This call also closes the
// collection, ensuring that no tasks are ever pushed after this
// call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:8 | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("CurrentThread").finish()
}
}
// ===== impl Core =====
impl Core {
/// Get and increment the current tick
fn tick(&mut self) {
self.tick = self.tick.wrapping_add(1);
}
fn next_task(&mut self, handle: &Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:9 | }
fn submit_metrics(&mut self, handle: &Handle) {
self.metrics.submit(&handle.shared.worker_metrics, 0);
}
}
#[cfg(tokio_taskdump)]
fn wake_deferred_tasks_and_free(context: &Context) {
let wakers = context.defer.take_deferred();
for waker in wakers {
waker.wake();
}
}
// ===== imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:10 | // Park until the thread is signaled
core.metrics.about_to_park();
core.submit_metrics(handle);
let (c, ()) = self.enter(core, || {
driver.park(&handle.driver);
self.defer.wake();
});
core = c;
core.metrics.unpark... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:11 | // Store the scheduler core in the thread-local context
//
// A drop-guard is employed at a higher level.
*self.core.borrow_mut() = Some(core);
// Execute the closure while tracking the execution budget
let ret = f();
// Take the scheduler core back
let core = s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:12 | /// Capture a snapshot of this runtime's state.
#[cfg(all(
tokio_unstable,
tokio_taskdump,
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(crate) fn dump(&self) -> crate::runtime::Dump {
use crate::runtime::dump;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Taking a taskdump could wakes every task, but we probably don't want
// the `yield_now` vector to be that large under normal circumstances.
// Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | pub(crate) fn worker_metrics(&self, worker: usize) -> &WorkerMetrics {
assert_eq!(0, worker);
&self.shared.worker_metrics
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
self.worker_metrics(worker).queue_depth()
}
pub(crate)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:15 | impl fmt::Debug for Handle {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("current_thread::Handle { ... }").finish()
}
}
// ===== impl Shared =====
impl Schedule for Arc<Handle> {
fn release(&self, task: &Task<Self>) -> Option<Task<Self>> {
self.shared.owne... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:16 | match self.shared.config.unhandled_panic {
UnhandledPanic::Ignore => {
// Do nothing
}
UnhandledPanic::ShutdownRuntime => {
use scheduler::Context::CurrentThread;
// This hook is only called from within the runt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:17 | }
// ===== CoreGuard =====
/// Used to ensure we always place the `Core` value back into its slot in
/// `CurrentThread`, even if the future panics.
struct CoreGuard<'a> {
context: scheduler::Context,
scheduler: &'a CurrentThread,
}
impl CoreGuard<'_> {
#[track_caller]
fn block_on<F: Future>(self, fu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:18 | return (core, None);
}
core.tick();
let entry = core.next_task(handle);
let task = match entry {
Some(entry) => entry,
None => {
core.metrics.end_processing_sche... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:19 | core.metrics.start_processing_scheduled_tasks();
}
});
match ret {
Some(ret) => ret,
None => {
// `block_on` panicked.
panic!("a spawned task panicked and the runtime is configured to shut down on unhandled panic");
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/scheduler/current_thread/mod.rs | 721 | 767 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:9 | }
fn submit_metrics(&mut self, handle: &Handle) {
self.metrics.submit(&handle.shared.worker_metrics, 0);
}
}
#[cfg(tokio_taskdump)]
fn wake_deferred_tasks_and_free(context: &Context) {
let wakers = context.defer.take_deferred();
for waker in wakers {
waker.wake();
}
}
// ===== imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:10 | // Park until the thread is signaled
core.metrics.about_to_park();
core.submit_metrics(handle);
let (c, ()) = self.enter(core, || {
driver.park(&handle.driver);
self.defer.wake();
});
core = c;
}
if let Some(f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:11 | *self.core.borrow_mut() = Some(core);
// Execute the closure while tracking the execution budget
let ret = f();
// Take the scheduler core back
let core = self.core.borrow_mut().take().expect("core missing");
(core, ret)
}
pub(crate) fn defer(&self, waker: &Waker) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:12 | tokio_taskdump,
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(crate) fn dump(&self) -> crate::runtime::Dump {
use crate::runtime::dump;
use task::trace::trace_current_thread;
let mut traces = vec![];
// to... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | &self.shared.worker_metrics
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
self.worker_metrics(worker).queue_depth()
}
pub(crate) fn num_blocking_threads(&self) -> usize {
self.blocking_spawner.num_threads()
}
pub(crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:15 | }
}
// ===== impl Shared =====
impl Schedule for Arc<Handle> {
fn release(&self, task: &Task<Self>) -> Option<Task<Self>> {
self.shared.owned.remove(task)
}
fn schedule(&self, task: task::Notified<Self>) {
use scheduler::Context::CurrentThread;
context::with_scheduler(|maybe_cx| ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:17 | /// Used to ensure we always place the `Core` value back into its slot in
/// `CurrentThread`, even if the future panics.
struct CoreGuard<'a> {
context: scheduler::Context,
scheduler: &'a CurrentThread,
}
impl CoreGuard<'_> {
#[track_caller]
fn block_on<F: Future>(self, future: F) -> F::Output {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:18 | core.tick();
let entry = core.next_task(handle);
let task = match entry {
Some(entry) => entry,
None => {
core.metrics.end_processing_scheduled_tasks();
core = if !context.d... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:19 | match ret {
Some(ret) => ret,
None => {
// `block_on` panicked.
panic!("a spawned task panicked and the runtime is configured to shut down on unhandled panic");
}
}
}
/// Enters the scheduler context. This sets the queue and other nece... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 1be8a8e691f48accda58874bf3a9241cea54daf4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8a8e691f48accda58874bf3a9241cea54daf4/tokio/src/runtime/scheduler/current_thread/mod.rs | 721 | 764 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 68d0e3cb5fc0b5e4348e5eeab79e44fc91f0f2d4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/68d0e3cb5fc0b5e4348e5eeab79e44fc91f0f2d4/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | self.worker_metrics(worker).queue_depth()
}
pub(crate) fn num_blocking_threads(&self) -> usize {
self.blocking_spawner.num_threads()
}
pub(crate) fn num_idle_blocking_threads(&self) -> usize {
self.blocking_spawner.num_idle_threads()
}
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 68d0e3cb5fc0b5e4348e5eeab79e44fc91f0f2d4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/68d0e3cb5fc0b5e4348e5eeab79e44fc91f0f2d4/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 9a75d6f7f70fd81f589a8209c548944bc3d05f84 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9a75d6f7f70fd81f589a8209c548944bc3d05f84/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | self.worker_metrics(worker).queue_depth()
}
pub(crate) fn num_blocking_threads(&self) -> usize {
self.blocking_spawner.num_threads()
}
pub(crate) fn num_idle_blocking_threads(&self) -> usize {
self.blocking_spawner.num_idle_threads()
}
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 9a75d6f7f70fd81f589a8209c548944bc3d05f84 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9a75d6f7f70fd81f589a8209c548944bc3d05f84/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | self.worker_metrics(worker).queue_depth()
}
pub(crate) fn num_blocking_threads(&self) -> usize {
self.blocking_spawner.num_threads()
}
pub(crate) fn num_idle_blocking_threads(&self) -> usize {
self.blocking_spawner.num_idle_threads()
}
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:15 | // ===== impl Shared =====
impl Schedule for Arc<Handle> {
fn release(&self, task: &Task<Self>) -> Option<Task<Self>> {
self.shared.owned.remove(task)
}
fn schedule(&self, task: task::Notified<Self>) {
use scheduler::Context::CurrentThread;
context::with_scheduler(|maybe_cx| match... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:16 | UnhandledPanic::ShutdownRuntime => {
use scheduler::Context::CurrentThread;
// This hook is only called from within the runtime, so
// `context::with_scheduler` should match with `&self`, i.e.
// there is no opportunity for a nested schedu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:17 | /// `CurrentThread`, even if the future panics.
struct CoreGuard<'a> {
context: scheduler::Context,
scheduler: &'a CurrentThread,
}
impl CoreGuard<'_> {
#[track_caller]
fn block_on<F: Future>(self, future: F) -> F::Output {
let ret = self.enter(|mut core, context| {
let waker = Hand... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:18 | let entry = core.next_task(handle);
let task = match entry {
Some(entry) => entry,
None => {
core.metrics.end_processing_scheduled_tasks();
core = if !context.defer.is_empty() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:19 | Some(ret) => ret,
None => {
// `block_on` panicked.
panic!("a spawned task panicked and the runtime is configured to shut down on unhandled panic");
}
}
}
/// Enters the scheduler context. This sets the queue and other necessary
/// scheduler ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 341b5daa6e4592d285674de4eb116c928fc9f29c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/341b5daa6e4592d285674de4eb116c928fc9f29c/tokio/src/runtime/scheduler/current_thread/mod.rs | 721 | 762 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | self.worker_metrics(worker).queue_depth()
}
pub(crate) fn num_blocking_threads(&self) -> usize {
self.blocking_spawner.num_threads()
}
pub(crate) fn num_idle_blocking_threads(&self) -> usize {
self.blocking_spawner.num_idle_threads()
}
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:15 | fn release(&self, task: &Task<Self>) -> Option<Task<Self>> {
self.shared.owned.remove(task)
}
fn schedule(&self, task: task::Notified<Self>) {
use scheduler::Context::CurrentThread;
context::with_scheduler(|maybe_cx| match maybe_cx {
Some(CurrentThread(cx)) if Arc::ptr_eq(s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:16 | // `context::with_scheduler` should match with `&self`, i.e.
// there is no opportunity for a nested scheduler to be
// called.
context::with_scheduler(|maybe_cx| match maybe_cx {
Some(CurrentThread(cx)) if Arc::ptr_eq(self, &cx.handle)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:17 | }
impl CoreGuard<'_> {
#[track_caller]
fn block_on<F: Future>(self, future: F) -> F::Output {
let ret = self.enter(|mut core, context| {
let waker = Handle::waker_ref(&context.handle);
let mut cx = std::task::Context::from_waker(&waker);
pin!(future);
c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:18 | None => {
core.metrics.end_processing_scheduled_tasks();
core = if !context.defer.is_empty() {
context.park_yield(core, handle)
} else {
context.park(core, handle)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:19 | }
}
}
/// Enters the scheduler context. This sets the queue and other necessary
/// scheduler state in the thread-local.
fn enter<F, R>(self, f: F) -> R
where
F: FnOnce(Box<Core>, &Context) -> (Box<Core>, R),
{
let context = self.context.expect_current_thread();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/current_thread/mod.rs | 721 | 758 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Therefore, we free its allocation.
wake_deferred_tasks_and_free(context);
});
dump::Dump::new(traces)
}
fn next_remote_task(&self) -> Option<Notified> {
self.shared.inject.pop()
}
fn waker_ref(me: &Arc<Self>) -> WakerRef<'_> {
// Set woken to true when e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 10c9eeb6c2af85961044b7cbb16a5a2d2e97287d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10c9eeb6c2af85961044b7cbb16a5a2d2e97287d/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:12 | tokio_taskdump,
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(crate) fn dump(&self) -> crate::runtime::Dump {
use crate::runtime::dump;
use task::trace::trace_current_thread;
let mut traces = vec![];
// to... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 84c5674c601dfc36ab417ff0ec01763c2dd30a5c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/84c5674c601dfc36ab417ff0ec01763c2dd30a5c/tokio/src/runtime/scheduler/current_thread/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:9 | }
fn submit_metrics(&mut self, handle: &Handle) {
self.metrics.submit(&handle.shared.worker_metrics, 0);
}
}
#[cfg(tokio_taskdump)]
fn wake_deferred_tasks_and_free(context: &Context) {
let wakers = context.defer.take_deferred();
for waker in wakers {
waker.wake();
}
}
// ===== imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:10 | // This check will fail if `before_park` spawns a task for us to run
// instead of parking the thread
if core.tasks.is_empty() {
// Park until the thread is signaled
core.metrics.about_to_park();
core.submit_metrics(handle);
let (c, ()) = self.enter(core,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:11 | }
fn enter<R>(&self, core: Box<Core>, f: impl FnOnce() -> R) -> (Box<Core>, R) {
// Store the scheduler core in the thread-local context
//
// A drop-guard is employed at a higher level.
*self.core.borrow_mut() = Some(core);
// Execute the closure while tracking the executi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:12 | handle
}
/// Capture a snapshot of this runtime's state.
#[cfg(all(
tokio_unstable,
tokio_taskdump,
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(crate) fn dump(&self) -> crate::runtime::Dump {
use crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:13 | // Avoid double borrow panic
drop(maybe_core);
// Taking a taskdump could wakes every task, but we probably don't want
// the `yield_now` vector to be that large under normal circumstances.
// Therefore, we free its allocation.
wake_deferred_tasks_and_free(co... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:14 | pub(crate) fn worker_metrics(&self, worker: usize) -> &WorkerMetrics {
assert_eq!(0, worker);
&self.shared.worker_metrics
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
self.worker_metrics(worker).queue_depth()
}
pub(crate)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 3a4aef17b2c70d255affa51eb473efcf703896e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/scheduler/current_thread/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:3 | /// Scheduler configuration options
config: Config,
/// Keeps track of various runtime metrics.
scheduler_metrics: SchedulerMetrics,
/// This scheduler only has one worker.
worker_metrics: WorkerMetrics,
}
/// Thread-local context.
///
/// pub(crate) to store in `runtime::context`.
pub(crate) str... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:4 | blocking_spawner: blocking::Spawner,
seed_generator: RngSeedGenerator,
config: Config,
) -> (CurrentThread, Arc<Handle>) {
let worker_metrics = WorkerMetrics::from_config(&config);
// Get the configured global queue interval, or use the default.
let global_queue_interval = c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:6 | fn take_core(&self, handle: &Arc<Handle>) -> Option<CoreGuard<'_>> {
let core = self.core.take()?;
Some(CoreGuard {
context: scheduler::Context::CurrentThread(Context {
handle: handle.clone(),
core: RefCell::new(Some(core)),
defer: Defer::new(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:7 | let core = shutdown2(core, handle);
*context.core.borrow_mut() = Some(core);
}
}
}
fn shutdown2(mut core: Box<Core>, handle: &Handle) -> Box<Core> {
// Drain the OwnedTasks collection. This call also closes the
// collection, ensuring that no tasks are ever pushed after this
// call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:15 | }
}
// ===== impl Shared =====
impl Schedule for Arc<Handle> {
fn release(&self, task: &Task<Self>) -> Option<Task<Self>> {
self.shared.owned.remove(task)
}
fn schedule(&self, task: task::Notified<Self>) {
use scheduler::Context::CurrentThread;
context::with_scheduler(|maybe_cx| ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:16 | // Do nothing
}
UnhandledPanic::ShutdownRuntime => {
use scheduler::Context::CurrentThread;
// This hook is only called from within the runtime, so
// `context::with_scheduler` should match with `&self`, i.e.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/current_thread/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:9 | }
fn submit_metrics(&mut self, handle: &Handle) {
self.metrics.submit(&handle.shared.worker_metrics, 0);
}
}
#[cfg(tokio_taskdump)]
fn wake_deferred_tasks_and_free(context: &Context) {
let wakers = context.defer.take_deferred();
for waker in wakers {
waker.wake();
}
}
// ===== imp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/scheduler/current_thread/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:10 | // This check will fail if `before_park` spawns a task for us to run
// instead of parking the thread
if core.tasks.is_empty() {
// Park until the thread is signaled
core.metrics.about_to_park();
core.submit_metrics(handle);
let (c, _) = self.enter(core, ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/scheduler/current_thread/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:16 | // Do nothing
}
UnhandledPanic::ShutdownRuntime => {
use scheduler::Context::CurrentThread;
// This hook is only called from within the runtime, so
// `context::with_scheduler` should match with `&self`, i.e.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/scheduler/current_thread/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:18 | core.tick();
let entry = core.next_task(handle);
let task = match entry {
Some(entry) => entry,
None => {
core.metrics.end_processing_scheduled_tasks();
core = if !context.d... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/scheduler/current_thread/mod.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/runtime/scheduler/current_thread/mod.rs:19 | match ret {
Some(ret) => ret,
None => {
// `block_on` panicked.
panic!("a spawned task panicked and the runtime is configured to shut down on unhandled panic");
}
}
}
/// Enters the scheduler context. This sets the queue and other nece... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/current_thread/mod.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/scheduler/current_thread/mod.rs | 721 | 764 |
tokio-rs/tokio:tokio/src/runtime/scheduler/defer.rs:1 | use std::cell::RefCell;
use std::task::Waker;
pub(crate) struct Defer {
deferred: RefCell<Vec<Waker>>,
}
impl Defer {
pub(crate) fn new() -> Defer {
Defer {
deferred: RefCell::default(),
}
}
pub(crate) fn defer(&self, waker: &Waker) {
let mut deferred = self.deferr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/defer.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/defer.rs | 1 | 43 |
tokio-rs/tokio:tokio/src/runtime/scheduler/defer.rs:1 | use std::cell::RefCell;
use std::task::Waker;
pub(crate) struct Defer {
deferred: RefCell<Vec<Waker>>,
}
impl Defer {
pub(crate) fn new() -> Defer {
Defer {
deferred: RefCell::default(),
}
}
pub(crate) fn defer(&self, waker: &Waker) {
let mut deferred = self.deferr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/defer.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/scheduler/defer.rs | 1 | 43 |
tokio-rs/tokio:tokio/src/runtime/scheduler/defer.rs:1 | use std::cell::RefCell;
use std::task::Waker;
pub(crate) struct Defer {
deferred: RefCell<Vec<Waker>>,
}
impl Defer {
pub(crate) fn new() -> Defer {
Defer {
deferred: Default::default(),
}
}
pub(crate) fn defer(&self, waker: &Waker) {
let mut deferred = self.deferr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/defer.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/scheduler/defer.rs | 1 | 43 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::Mutex;
use crate::runtime::task;
mod pop;
pub(crate) use pop::Pop;
mod shared;
pub(crate) use shared::Shared;
mod synced;
pub(crate) use synced::Synced;
cfg_rt_multi_thread! {
mod rt_multi_thread;
}
mod metrics;
/// Gro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:2 | let synced = self.synced.lock();
self.shared.is_closed(&synced)
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self) -> bool {
let mut synced = self.synced.lock();
self.shared.close(&mut synced)
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject.rs | 41 | 70 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::Mutex;
use crate::runtime::task;
mod pop;
pub(crate) use pop::Pop;
mod shared;
pub(crate) use shared::Shared;
mod synced;
pub(crate) use synced::Synced;
cfg_rt_multi_thread! {
mod rt_multi_thread;
}
mod metrics;
/// Gro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | 542197cdb9031384b05ab81b64c6b6dc057a3dfc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/542197cdb9031384b05ab81b64c6b6dc057a3dfc/tokio/src/runtime/scheduler/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::Mutex;
use crate::runtime::task;
mod pop;
pub(crate) use pop::Pop;
mod shared;
pub(crate) use shared::Shared;
mod synced;
pub(crate) use synced::Synced;
cfg_rt_multi_thread! {
mod rt_multi_thread;
}
cfg_unstable_metrics!... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:2 | #[cfg(tokio_taskdump)]
pub(crate) fn is_closed(&self) -> bool {
let synced = self.synced.lock();
self.shared.is_closed(&synced)
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self) -> bool {
let mut... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/scheduler/inject.rs | 41 | 72 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject.rs:1 | //! Inject queue used to send wakeups to a work-stealing scheduler
use crate::loom::sync::Mutex;
use crate::runtime::task;
mod pop;
pub(crate) use pop::Pop;
mod shared;
pub(crate) use shared::Shared;
mod synced;
pub(crate) use synced::Synced;
cfg_rt_multi_thread! {
mod rt_multi_thread;
}
cfg_metrics! {
mo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/metrics.rs:1 | use super::Inject;
impl<T: 'static> Inject<T> {
pub(crate) fn len(&self) -> usize {
self.shared.len()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/metrics.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/metrics.rs | 1 | 7 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/pop.rs:1 | use super::Synced;
use crate::runtime::task;
use std::marker::PhantomData;
pub(crate) struct Pop<'a, T: 'static> {
len: usize,
synced: &'a mut Synced,
_p: PhantomData<T>,
}
impl<'a, T: 'static> Pop<'a, T> {
pub(super) fn new(len: usize, synced: &'a mut Synced) -> Pop<'a, T> {
Pop {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/pop.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/pop.rs | 1 | 55 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:1 | use super::{Shared, Synced};
use crate::runtime::scheduler::Lock;
use crate::runtime::task;
use std::sync::atomic::Ordering::Release;
impl<'a> Lock<Synced> for &'a mut Synced {
type Handle = &'a mut Synced;
fn lock(self) -> Self::Handle {
self
}
}
impl AsMut<Synced> for Synced {
fn as_mut(&... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:2 | let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:3 | L: Lock<Synced>,
{
debug_assert!(unsafe { batch_tail.get_queue_next().is_none() });
let mut synced = shared.lock();
if synced.as_mut().is_closed {
drop(synced);
let mut curr = Some(batch_head);
while let Some(task) = curr {
// Safety: e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 81 | 122 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:1 | use super::{Shared, Synced};
use crate::runtime::scheduler::Lock;
use crate::runtime::task;
use std::sync::atomic::Ordering::Release;
impl<'a> Lock<Synced> for &'a mut Synced {
type Handle = &'a mut Synced;
fn lock(self) -> Self::Handle {
self
}
}
impl AsMut<Synced> for Synced {
fn as_mut(&... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | 0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:2 | let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | 0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:3 | let mut curr = Some(batch_head);
while let Some(task) = curr {
curr = task.get_queue_next();
let _ = unsafe { task::Notified::<T>::from_raw(task) };
}
return;
}
let synced = synced.as_mut();
if let Some(tail) = synced.tail ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | 0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0ec4d0db4d24af74cea40cf0ceed6b7a0a5ff183/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 81 | 113 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:2 | let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:2 | let mut counter = 1;
// We are going to be called with an `std::iter::Chain`, and that
// iterator overrides `for_each` to something that is easier for the
// compiler to optimize than a loop.
iter.for_each(|next| {
let next = next.into_raw();
// safety: Holding... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 41 | 98 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/rt_multi_thread.rs:3 | unsafe {
tail.set_queue_next(Some(batch_head));
}
} else {
synced.head = Some(batch_head);
}
synced.tail = Some(batch_tail);
// Increment the count.
//
// safety: All updates to the len atomic are guarded by the mutex. As
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/rt_multi_thread.rs | 81 | 98 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:1 | use super::{Pop, Synced};
use crate::loom::sync::atomic::AtomicUsize;
use crate::runtime::task;
use std::marker::PhantomData;
use std::sync::atomic::Ordering::{Acquire, Release};
pub(crate) struct Shared<T: 'static> {
/// Number of pending tasks in the queue. This helps prevent unnecessary
/// locking in the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/shared.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:2 | #[cfg(any(feature = "taskdump", feature = "rt-multi-thread"))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self, synced: &mut Synced) ->... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/shared.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:3 | // safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
unsafe { tail.set_queue_next(Some(task)) };
} else {
synced.head = Some(task);
}
synced.tail = Some(task);
self.len.store(len + 1, Release);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/shared.rs | 81 | 121 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:2 | #[cfg(any(feature = "taskdump", feature = "rt-multi-thread"))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self, synced: &mut Synced) ->... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/scheduler/inject/shared.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:3 | // safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
unsafe { tail.set_queue_next(Some(task)) };
} else {
synced.head = Some(task);
}
synced.tail = Some(task);
self.len.store(len + 1, Release);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/scheduler/inject/shared.rs | 81 | 121 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:1 | use super::{Pop, Synced};
use crate::loom::sync::atomic::AtomicUsize;
use crate::runtime::task;
use std::marker::PhantomData;
use std::sync::atomic::Ordering::{Acquire, Release};
pub(crate) struct Shared<T: 'static> {
/// Number of pending tasks in the queue. This helps prevent unnecessary
/// locking in the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | 9ed595767d01c400955122d276b34ab52b3a6aab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/scheduler/inject/shared.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:2 | #[cfg(any(tokio_taskdump, feature = "rt-multi-thread"))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self, synced: &mut Synced) -> bool ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | 9ed595767d01c400955122d276b34ab52b3a6aab | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/scheduler/inject/shared.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:1 | use super::{Pop, Synced};
use crate::loom::sync::atomic::AtomicUsize;
use crate::runtime::task;
use std::marker::PhantomData;
use std::sync::atomic::Ordering::{Acquire, Release};
pub(crate) struct Shared<T: 'static> {
/// Number of pending tasks in the queue. This helps prevent unnecessary
/// locking in the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/scheduler/inject/shared.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:2 | #[cfg(any(
tokio_taskdump,
all(feature = "rt-multi-thread", not(target_os = "wasi"))
))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/scheduler/inject/shared.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:3 | debug_assert!(unsafe { task.get_queue_next().is_none() });
if let Some(tail) = synced.tail {
// safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
unsafe { tail.set_queue_next(Some(task)) };
} else {
synced.h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/scheduler/inject/shared.rs | 81 | 124 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:3 | debug_assert!(unsafe { task.get_queue_next().is_none() });
if let Some(tail) = synced.tail {
// safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
unsafe { tail.set_queue_next(Some(task)) };
} else {
synced.h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/scheduler/inject/shared.rs | 81 | 122 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:1 | use super::{Pop, Synced};
use crate::loom::sync::atomic::AtomicUsize;
use crate::runtime::task;
use std::marker::PhantomData;
use std::sync::atomic::Ordering::{Acquire, Release};
pub(crate) struct Shared<T: 'static> {
/// Number of pending tasks in the queue. This helps prevent unnecessary
/// locking in the... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/shared.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:2 | #[cfg(any(tokio_taskdump, all(feature = "rt-multi-thread", not(tokio_wasi))))]
pub(crate) fn is_closed(&self, synced: &Synced) -> bool {
synced.is_closed
}
/// Closes the injection queue, returns `true` if the queue is open when the
/// transition is made.
pub(crate) fn close(&self, synced:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/shared.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/shared.rs:3 | // safety: Holding the Notified for a task guarantees exclusive
// access to the `queue_next` field.
unsafe { tail.set_queue_next(Some(task)) };
} else {
synced.head = Some(task);
}
synced.tail = Some(task);
self.len.store(len + 1, Release);
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/shared.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/shared.rs | 81 | 119 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/synced.rs:1 | #![cfg_attr(
any(not(all(tokio_unstable, feature = "full")), target_family = "wasm"),
allow(dead_code)
)]
use crate::runtime::task;
pub(crate) struct Synced {
/// True if the queue is closed.
pub(super) is_closed: bool,
/// Linked-list head.
pub(super) head: Option<task::RawTask>,
/// Li... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/synced.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/inject/synced.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/synced.rs:1 | #![cfg_attr(
any(not(all(tokio_unstable, feature = "full")), target_family = "wasm"),
allow(dead_code)
)]
use crate::runtime::task;
pub(crate) struct Synced {
/// True if the queue is closed.
pub(super) is_closed: bool,
/// Linked-list head.
pub(super) head: Option<task::RawTask>,
/// Li... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/synced.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/scheduler/inject/synced.rs | 1 | 41 |
tokio-rs/tokio:tokio/src/runtime/scheduler/inject/synced.rs:1 | use crate::runtime::task;
pub(crate) struct Synced {
/// True if the queue is closed.
pub(super) is_closed: bool,
/// Linked-list head.
pub(super) head: Option<task::RawTask>,
/// Linked-list tail.
pub(super) tail: Option<task::RawTask>,
}
unsafe impl Send for Synced {}
unsafe impl Sync for ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/inject/synced.rs | MIT | fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fb4d43017d6cb7b7cbdfbe5fc189bca0291ff215/tokio/src/runtime/scheduler/inject/synced.rs | 1 | 32 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.