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/task/trace/mod.rs:5 | if ptr::eq(frame.symbol_address(), trace_leaf as *const _) {
above_leaf = true;
}
// only continue unwinding if we're below `Trace::root`
below_root
});
}
collector.ba... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | Poll::Ready(())
}
}
impl fmt::Display for Trace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Tree::from_trace(self.clone()).fmt(f)
}
}
fn defer<F: FnOnce() -> R, R>(f: F) -> impl Drop {
use std::mem::ManuallyDrop;
struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<F>);
im... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | Context::with_current_frame(|current| {
frame.parent = current.take();
current.set(Some(NonNull::from(&frame)));
});
let _restore = defer(|| {
Context::with_current_frame(|current| {
current.set(frame.parent);
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/trace/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:8 | .into_iter()
.map(|task| {
let ((), trace) = Trace::capture(|| task.poll());
trace
})
.collect()
}
cfg_rt_multi_thread! {
use crate::loom::sync::Mutex;
use crate::runtime::scheduler::multi_thread;
use crate::runtime::scheduler::multi_thread::Synced;
use c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/trace/mod.rs | 281 | 336 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:9 | owned.for_each(|task| {
// set the notified bit
task.as_raw().state().transition_to_notified_for_tracing();
// trace the task
let ((), trace) = Trace::capture(|| task.as_raw().poll());
traces.push(trace);
// reschedule the task
let _ ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/task/trace/mod.rs | 321 | 336 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | if ptr::eq(frame.symbol_address(), trace_leaf as *const _) {
above_leaf = true;
}
// only continue unwinding if we're below `Trace::root`
below_root
});
}
collector.ba... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | impl fmt::Display for Trace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Tree::from_trace(self.clone()).fmt(f)
}
}
fn defer<F: FnOnce() -> R, R>(f: F) -> impl Drop {
use std::mem::ManuallyDrop;
struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<F>);
impl<F: FnOnce() -> R, R> D... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | let _restore = defer(|| {
Context::with_current_frame(|current| {
current.set(frame.parent);
});
});
let this = self.project();
this.future.poll(cx)
}
}
}
/// Trace and poll all tasks of the current_thread runtime.
pub... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/task/trace/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:8 | })
.collect()
}
cfg_rt_multi_thread! {
use crate::loom::sync::Mutex;
use crate::runtime::scheduler::multi_thread;
use crate::runtime::scheduler::multi_thread::Synced;
use crate::runtime::scheduler::inject::Shared;
/// Trace and poll all tasks of the current_thread runtime.
///
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/task/trace/mod.rs | 281 | 332 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:9 | // trace the task
let ((), trace) = Trace::capture(|| task.as_raw().poll());
traces.push(trace);
// reschedule the task
let _ = task.as_raw().state().transition_to_notified_by_ref();
task.as_raw().schedule();
});
traces
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/task/trace/mod.rs | 321 | 332 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | if ptr::eq(frame.symbol_address(), trace_leaf as *const _) {
above_leaf = true;
}
// only continue unwinding if we're below `Trace::root`
below_root
});
}
collector.ba... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | Tree::from_trace(self.clone()).fmt(f)
}
}
fn defer<F: FnOnce() -> R, R>(f: F) -> impl Drop {
use std::mem::ManuallyDrop;
struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<F>);
impl<F: FnOnce() -> R, R> Drop for Defer<F, R> {
#[inline(always)]
fn drop(&mut self) {
unsafe {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | Context::with_current_frame(|current| {
current.set(frame.parent);
});
});
let this = self.project();
this.future.poll(cx)
}
}
}
/// Trace and poll all tasks of the current_thread runtime.
pub(in crate::runtime) fn trace_current_threa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/task/trace/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:8 | }
cfg_rt_multi_thread! {
use crate::loom::sync::Mutex;
use crate::runtime::scheduler::multi_thread;
use crate::runtime::scheduler::multi_thread::Synced;
use crate::runtime::scheduler::inject::Shared;
/// Trace and poll all tasks of the current_thread runtime.
///
/// ## Safety
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/task/trace/mod.rs | 281 | 330 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:9 | traces.push(trace);
// reschedule the task
let _ = task.as_raw().state().transition_to_notified_by_ref();
task.as_raw().schedule();
});
traces
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/038c4d9999ea39e4c9f8ed3f911c5a3c02ebf574/tokio/src/runtime/task/trace/mod.rs | 321 | 330 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | Context::with_current_frame(|current| {
current.set(frame.parent);
});
});
let this = self.project();
this.future.poll(cx)
}
}
}
/// Trace and poll all tasks of the current_thread runtime.
pub(in crate::runtime) fn trace_current_threa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/task/trace/mod.rs | 241 | 281 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::context;
use crate::runtime::scheduler::{self, current_thread};
use crate::runtime::task::Inject;
use backtrace::BacktraceFrame;
use std::cell::Cell;
use std::collections::VecDeque;
use std::ffi::c_void;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:3 | where
F: FnOnce(&Self) -> R,
{
crate::runtime::context::with_trace(f)
}
unsafe fn with_current_frame<F, R>(f: F) -> R
where
F: FnOnce(&Cell<Option<NonNull<Frame>>>) -> R,
{
Self::try_with_current(|context| f(&context.active_frame)).expect(FAIL_NO_THREAD_LOCAL)
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:4 | Context::with_current_collector(|current| current.replace(previous)).unwrap();
(result, collector)
}
/// The root of a trace.
#[inline(never)]
pub(crate) fn root<F>(future: F) -> Root<F> {
Root { future }
}
}
/// If this is a sub-invocation of [`Trace::capture`], capture a backtra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | }
if ptr::eq(frame.symbol_address(), trace_leaf as *const _) {
above_leaf = true;
}
// only continue unwinding if we're below `Trace::root`
below_root
});
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Tree::from_trace(self.clone()).fmt(f)
}
}
fn defer<F: FnOnce() -> R, R>(f: F) -> impl Drop {
use std::mem::ManuallyDrop;
struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<F>);
impl<F: FnOnce() -> R, R> Drop for Defer<F, R> {
#[in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | let _restore = defer(|| {
Context::with_current_frame(|current| {
current.set(frame.parent);
});
});
let this = self.project();
this.future.poll(cx)
}
}
}
/// Trace and poll all tasks of the current_thread runtime.
pub... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | c748f4965eae883a2291945116d84cab5d657100 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c748f4965eae883a2291945116d84cab5d657100/tokio/src/runtime/task/trace/mod.rs | 241 | 282 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::scheduler::current_thread;
use crate::runtime::task::Inject;
use backtrace::BacktraceFrame;
use std::cell::Cell;
use std::collections::VecDeque;
use std::ffi::c_void;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::ptr::{self, NonNull};
use std::task::{... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:2 | }
/// An tree execution trace.
///
/// Traces are captured with [`Trace::capture`], rooted with [`Trace::root`]
/// and leaved with [`trace_leaf`].
#[derive(Clone, Debug)]
pub(crate) struct Trace {
// The linear backtraces that comprise this trace. These linear traces can
// be re-knitted into a tree.
back... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:3 | {
crate::runtime::context::with_trace(f)
}
unsafe fn with_current_frame<F, R>(f: F) -> R
where
F: FnOnce(&Cell<Option<NonNull<Frame>>>) -> R,
{
Self::try_with_current(|context| f(&context.active_frame)).expect(FAIL_NO_THREAD_LOCAL)
}
fn with_current_collector<F, R>(f: F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:4 | (result, collector)
}
/// The root of a trace.
#[inline(never)]
pub(crate) fn root<F>(future: F) -> Root<F> {
Root { future }
}
}
/// If this is a sub-invocation of [`Trace::capture`], capture a backtrace.
///
/// The captured backtrace will be returned by [`Trace::capture`].
///
/// Invok... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | if ptr::eq(frame.symbol_address(), trace_leaf as *const _) {
above_leaf = true;
}
// only continue unwinding if we're below `Trace::root`
below_root
});
}
collector.ba... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<F>);
impl<F: FnOnce() -> R, R> Drop for Defer<F, R> {
#[inline(always)]
fn drop(&mut self) {
unsafe {
ManuallyDrop::take(&mut self.0)();
}
}
}
Defer(ManuallyDrop::new(f))
}
impl<T: Future> Futur... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | this.future.poll(cx)
}
}
}
/// Trace and poll all tasks of the current_thread runtime.
pub(in crate::runtime) fn trace_current_thread(
owned: &OwnedTasks<Arc<current_thread::Handle>>,
local: &mut VecDeque<Notified<Arc<current_thread::Handle>>>,
injection: &Inject<Arc<current_thread::Handle>>,
)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/runtime/task/trace/mod.rs | 241 | 275 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:2 | }
/// An tree execution trace.
///
/// Traces are captured with [`Trace::capture`], rooted with [`Trace::root`]
/// and leaved with [`trace_leaf`].
#[derive(Clone, Debug)]
pub(crate) struct Trace {
// The linear backtraces that comprise this trace. These linear traces can
// be re-knitted into a tree.
back... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:3 | where
F: FnOnce(&Cell<Option<NonNull<Frame>>>) -> R,
{
Self::with_current(|context| f(&context.active_frame))
}
fn with_current_collector<F, R>(f: F) -> R
where
F: FnOnce(&Cell<Option<Trace>>) -> R,
{
unsafe { Self::with_current(|context| f(&context.collector)) }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:4 | /// If this is a sub-invocation of [`Trace::capture`], capture a backtrace.
///
/// The captured backtrace will be returned by [`Trace::capture`].
///
/// Invoking this function does nothing when it is not a sub-invocation
/// [`Trace::capture`].
// This function is marked `#[inline(never)]` to ensure that it gets a di... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | context_cell.collector.set(Some(collector));
true
} else {
false
}
})
};
if did_trace {
// Use the same logic that `yield_now` uses to send out wakeups after
// the task yields.
let defer = crate::runtime::context::with_def... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | }
Defer(ManuallyDrop::new(f))
}
impl<T: Future> Future for Root<T> {
type Output = T::Output;
#[inline(never)]
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
// SAFETY: The context's current frame is restored to its original state
// before `frame` i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | ) -> Vec<Trace> {
// clear the local and injection queues
local.clear();
while let Some(task) = injection.pop() {
drop(task);
}
// notify each task
let mut tasks = vec![];
owned.for_each(|task| {
// set the notified bit
task.as_raw().state().transition_to_notified_f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 93bde0870fd706afbca795b94ce6e46d1f878edb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/93bde0870fd706afbca795b94ce6e46d1f878edb/tokio/src/runtime/task/trace/mod.rs | 241 | 265 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::scheduler::current_thread;
use backtrace::BacktraceFrame;
use std::cell::Cell;
use std::collections::VecDeque;
use std::ffi::c_void;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::ptr::{self, NonNull};
use std::task::{self, Poll};
mod symbol;
mod tree... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:2 | /// An tree execution trace.
///
/// Traces are captured with [`Trace::capture`], rooted with [`Trace::root`]
/// and leaved with [`trace_leaf`].
#[derive(Clone, Debug)]
pub(crate) struct Trace {
// The linear backtraces that comprise this trace. These linear traces can
// be re-knitted into a tree.
backtra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:3 | F: FnOnce(&Cell<Option<NonNull<Frame>>>) -> R,
{
Self::with_current(|context| f(&context.active_frame))
}
fn with_current_collector<F, R>(f: F) -> R
where
F: FnOnce(&Cell<Option<Trace>>) -> R,
{
unsafe { Self::with_current(|context| f(&context.collector)) }
}
}
impl Tra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:4 | /// If this is a sub-invocation of [`Trace::capture`], capture a backtrace.
///
/// The captured backtrace will be returned by [`Trace::capture`].
///
/// Invoking this function does nothing when it is not a sub-invocation
/// [`Trace::capture`].
// This function is marked `#[inline(never)]` to ensure that it gets a di... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | true
} else {
false
}
})
};
if did_trace {
// Use the same logic that `yield_now` uses to send out wakeups after
// the task yields.
let defer = crate::runtime::context::with_defer(|rt| {
rt.defer(cx.waker());
});
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | Defer(ManuallyDrop::new(f))
}
impl<T: Future> Future for Root<T> {
type Output = T::Output;
#[inline(never)]
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
// SAFETY: The context's current frame is restored to its original state
// before `frame` is dropp... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:7 | // clear the local and injection queues
local.clear();
injection.clear();
// notify each task
let mut tasks = vec![];
owned.for_each(|task| {
// set the notified bit
task.as_raw().state().transition_to_notified_for_tracing();
// store the raw tasks into a vec
tasks.p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/task/trace/mod.rs | 241 | 261 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:1 | use crate::loom::sync::Arc;
use crate::runtime::scheduler::current_thread;
use backtrace::BacktraceFrame;
use std::cell::Cell;
use std::collections::VecDeque;
use std::ffi::c_void;
use std::fmt;
use std::future::Future;
use std::pin::Pin;
use std::ptr::{self, NonNull};
use std::task::{self, Poll};
mod symbol;
mod tree... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:2 | /// An tree execution trace.
///
/// Traces are captured with [`Trace::capture`], rooted with [`Trace::root`]
/// and leaved with [`Trace::leaf`].
#[derive(Clone, Debug)]
pub(crate) struct Trace {
// The linear backtraces that comprise this trace. These linear traces can
// be re-knitted into a tree.
backtr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:3 | F: FnOnce(&Cell<Option<NonNull<Frame>>>) -> R,
{
Self::with_current(|context| f(&context.active_frame))
}
fn with_current_collector<F, R>(f: F) -> R
where
F: FnOnce(&Cell<Option<Trace>>) -> R,
{
unsafe { Self::with_current(|context| f(&context.collector)) }
}
}
impl Tra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:4 | ///
/// The captured backtrace will be returned by [`Trace::capture`].
///
/// Invoking this function does nothing when it is not a sub-invocation
/// [`Trace::capture`].
// This function is marked `#[inline(never)]` to ensure that it gets a distinct `Frame` in the
// backtrace, below which fram... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:5 | }
});
}
}
}
impl fmt::Display for Trace {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Tree::from_trace(self.clone()).fmt(f)
}
}
fn defer<F: FnOnce() -> R, R>(f: F) -> impl Drop {
use std::mem::ManuallyDrop;
struct Defer<F: FnOnce() -> R, R>(ManuallyDrop<... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/trace/mod.rs:6 | };
Context::with_current_frame(|current| {
frame.parent = current.take();
current.set(Some(NonNull::from(&frame)));
});
let _restore = defer(|| {
Context::with_current_frame(|current| {
current.set(frame.parent);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/mod.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/mod.rs | 201 | 246 |
tokio-rs/tokio:tokio/src/runtime/task/trace/symbol.rs:1 | use backtrace::BacktraceSymbol;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::ptr;
/// A symbol in a backtrace.
///
/// This wrapper type serves two purposes. The first is that it provides a
/// representation of a symbol that can be inserted into hashmaps and hashsets;
/// the [`backtrace`] crate does not def... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/symbol.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/symbol.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/symbol.rs:2 | }
}
impl PartialEq for Symbol {
fn eq(&self, other: &Self) -> bool {
(self.parent_hash == other.parent_hash)
&& match (self.symbol.name(), other.symbol.name()) {
(None, None) => true,
(Some(lhs_name), Some(rhs_name)) => lhs_name.as_bytes() == rhs_name.as_bytes(),... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/symbol.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/symbol.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/runtime/task/trace/symbol.rs:3 | f.write_str(":")?;
fmt::Display::fmt(&lineno, f)?;
if let Some(colno) = self.symbol.colno() {
f.write_str(":")?;
fmt::Display::fmt(&colno, f)?;
}
}
}
Ok(())
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/symbol.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/symbol.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/runtime/task/trace/trace_impl.rs:1 | //! Current `backtrace::trace` + collector based backtrace implementation
//!
//! This implementation may eventually be extracted into a separate `tokio-taskdump` crate.
use std::ptr;
use crate::runtime::task::trace::{Trace, TraceMeta};
/// Capture a backtrace via `backtrace::trace` and collect it into `trace`.
pub(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/trace_impl.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/trace_impl.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/runtime/task/trace/trace_impl.rs:1 | //! Current `backtrace::trace` + collector based backtrace implementation
//!
//! This implementation may eventually be extracted into a separate `tokio-taskdump` crate.
use std::ptr;
use crate::runtime::task::trace::{trace_with, Trace, TraceMeta};
/// Capture using the default `backtrace::trace`-based implementatio... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/trace_impl.rs | MIT | 36d12d2686a64b9146c674e02e3cf81d8f87163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36d12d2686a64b9146c674e02e3cf81d8f87163d/tokio/src/runtime/task/trace/trace_impl.rs | 1 | 43 |
tokio-rs/tokio:tokio/src/runtime/task/trace/trace_impl.rs:1 | //! Current `backtrace::trace` + collector based backtrace implementation
//!
//! This implementation may eventually be extracted into a separate `tokio-taskdump` crate.
use std::{cell::Cell, ptr};
use crate::runtime::task::trace::{trace_with, Trace, TraceMeta};
use super::defer;
/// Thread local state used to comm... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/trace_impl.rs | MIT | bbdba7101de6ce5329d84021ce669f185cc430b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/src/runtime/task/trace/trace_impl.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/trace_impl.rs:2 | // take the collector before _restore runs
let collector = TRACE_CONTEXT.with(|state| state.collector.take()).unwrap();
(result, collector)
}
/// Capture a backtrace via `backtrace::trace` and collect it into `STATE`
#[inline(never)]
pub(crate) fn trace_leaf(meta: &TraceMeta) {
TRACE_CONTEXT.with(|state| ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/trace_impl.rs | MIT | bbdba7101de6ce5329d84021ce669f185cc430b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bbdba7101de6ce5329d84021ce669f185cc430b3/tokio/src/runtime/task/trace/trace_impl.rs | 41 | 74 |
tokio-rs/tokio:tokio/src/runtime/task/trace/tree.rs:1 | use std::collections::{hash_map::DefaultHasher, HashMap, HashSet};
use std::fmt;
use std::hash::{Hash, Hasher};
use super::{Backtrace, Symbol, SymbolTrace, Trace};
/// An adjacency list representation of an execution tree.
///
/// This tree provides a convenient intermediate representation for formatting
/// [`Trace`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/tree.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/tree.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/tree.rs:2 | }
Tree { roots, edges }
}
/// Produces the sub-symbols of a given symbol.
fn consequences(&self, frame: &Symbol) -> Option<impl ExactSizeIterator<Item = &Symbol>> {
Some(self.edges.get(frame)?.iter())
}
/// Format this [`Tree`] as a textual tree.
fn display<W: fmt::Write>(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/tree.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/tree.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/trace/tree.rs:3 | for (i, consequence) in consequences.enumerate() {
let is_last = i == len - 1;
writeln!(f)?;
self.display(f, consequence, is_last, &next)?;
}
}
Ok(())
}
}
impl fmt::Display for Tree {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/tree.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/trace/tree.rs | 81 | 126 |
tokio-rs/tokio:tokio/src/runtime/task/trace/tree.rs:1 | use std::collections::{hash_map::DefaultHasher, HashMap, HashSet};
use std::fmt;
use std::hash::{Hash, Hasher};
use super::{Backtrace, Symbol, SymbolTrace, Trace};
/// An adjacency list representation of an execution tree.
///
/// This tree provides a convenient intermediate representation for formatting
/// [`Trace`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/tree.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/tree.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/trace/tree.rs:2 | }
Tree { roots, edges }
}
/// Produces the sub-symbols of a given symbol.
fn consequences(&self, frame: &Symbol) -> Option<impl ExactSizeIterator<Item = &Symbol>> {
Some(self.edges.get(frame)?.iter())
}
/// Format this [`Tree`] as a textual tree.
fn display<W: fmt::Write>(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/trace/tree.rs | MIT | 660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/660eac71f0ac7274dc3ba6dd92df9ff2ea61be9f/tokio/src/runtime/task/trace/tree.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::runtime::task::{Header, RawTask, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(crate) struct WakerRef<'a, S: 'static> {
waker: ManuallyDrop<Waker>,
_p: PhantomData<(&'a Header, S)>,
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | }
}
cfg_trace! {
/// # Safety
///
/// `$header` must be a valid pointer to a [`Header`].
macro_rules! trace {
($header:expr, $op:expr) => {
if let Some(id) = Header::get_tracing_id(&$header) {
tracing::trace!(
target: "tokio::task::waker",
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:3 | unsafe fn drop_waker(ptr: *const ()) {
// Safety: `ptr` was created from a `Header` pointer in function `waker_ref`.
let ptr = unsafe { NonNull::new_unchecked(ptr as *mut Header) };
// TODO; replace to #[expect(unused_unsafe)] after bumping MSRV to 1.81.0.
#[cfg_attr(not(all(tokio_unstable, feature = "t... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/waker.rs | 81 | 124 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::runtime::task::{Header, RawTask, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ManuallyDrop<Waker>,
_p: PhantomData<(&'a Header, S)>,
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::runtime::task::{Header, RawTask, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ManuallyDrop<Waker>,
_p: PhantomData<(&'a Header, S)>,
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 5128601898c788bd1f9cc044eee2859e3b213998 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5128601898c788bd1f9cc044eee2859e3b213998/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | }
}
cfg_trace! {
macro_rules! trace {
($header:expr, $op:expr) => {
if let Some(id) = Header::get_tracing_id(&$header) {
tracing::trace!(
target: "tokio::task::waker",
op = $op,
task.id = id.into_u64(),
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 5128601898c788bd1f9cc044eee2859e3b213998 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5128601898c788bd1f9cc044eee2859e3b213998/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:3 | unsafe fn wake_by_val(ptr: *const ()) {
let ptr = NonNull::new_unchecked(ptr as *mut Header);
trace!(ptr, "waker.wake");
let raw = RawTask::from_raw(ptr);
raw.wake_by_val();
}
// Wake without consuming the waker
unsafe fn wake_by_ref(ptr: *const ()) {
let ptr = NonNull::new_unchecked(ptr as *mut He... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 5128601898c788bd1f9cc044eee2859e3b213998 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5128601898c788bd1f9cc044eee2859e3b213998/tokio/src/runtime/task/waker.rs | 81 | 102 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::future::Future;
use crate::runtime::task::{Header, RawTask, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ManuallyDrop<Waker>,
_p: Phanto... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | fn deref(&self) -> &Waker {
&self.waker
}
}
cfg_trace! {
macro_rules! trace {
($header:expr, $op:expr) => {
if let Some(id) = Header::get_tracing_id(&$header) {
tracing::trace!(
target: "tokio::task::waker",
op = $op,
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:3 | }
unsafe fn wake_by_val(ptr: *const ()) {
let ptr = NonNull::new_unchecked(ptr as *mut Header);
trace!(ptr, "waker.wake");
let raw = RawTask::from_raw(ptr);
raw.wake_by_val();
}
// Wake without consuming the waker
unsafe fn wake_by_ref(ptr: *const ()) {
let ptr = NonNull::new_unchecked(ptr as *mut... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/45e37dbfa27162e3ecb1ca2a902a7d21eeecda8b/tokio/src/runtime/task/waker.rs | 81 | 104 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::future::Future;
use crate::runtime::task::harness::Harness;
use crate::runtime::task::{Header, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | fn deref(&self) -> &Waker {
&self.waker
}
}
cfg_trace! {
macro_rules! trace {
($harness:expr, $op:expr) => {
if let Some(id) = $harness.id() {
tracing::trace!(
target: "tokio::task::waker",
op = $op,
task.id... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:3 | }
unsafe fn drop_waker<T, S>(ptr: *const ())
where
T: Future,
S: Schedule,
{
let ptr = NonNull::new_unchecked(ptr as *mut Header);
let harness = Harness::<T, S>::from_raw(ptr);
trace!(harness, "waker.drop");
harness.drop_reference();
}
unsafe fn wake_by_val<T, S>(ptr: *const ())
where
T: F... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/src/runtime/task/waker.rs | 81 | 130 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:4 | {
let ptr = header.as_ptr() as *const ();
let vtable = &RawWakerVTable::new(
clone_waker::<T, S>,
wake_by_val::<T, S>,
wake_by_ref::<T, S>,
drop_waker::<T, S>,
);
RawWaker::new(ptr, vtable)
} | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f3e340a35b306e926e78537a0dd65b2e9b9cdc89 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f3e340a35b306e926e78537a0dd65b2e9b9cdc89/tokio/src/runtime/task/waker.rs | 121 | 130 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::future::Future;
use crate::runtime::task::harness::Harness;
use crate::runtime::task::{Header, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::future::Future;
use crate::runtime::task::harness::Harness;
use crate::runtime::task::{Header, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f55b77aaddaed8e48a8c0d81c66da82f12433087 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f55b77aaddaed8e48a8c0d81c66da82f12433087/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | fn deref(&self) -> &Waker {
&self.waker
}
}
cfg_trace! {
macro_rules! trace {
($harness:expr, $op:expr) => {
if let Some(id) = $harness.id() {
tracing::trace!(
target: "tokio::task::waker",
op = $op,
task.id... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f55b77aaddaed8e48a8c0d81c66da82f12433087 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f55b77aaddaed8e48a8c0d81c66da82f12433087/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:3 | }
unsafe fn drop_waker<T, S>(ptr: *const ())
where
T: Future,
S: Schedule,
{
let ptr = NonNull::new_unchecked(ptr as *mut Header);
let harness = Harness::<T, S>::from_raw(ptr);
trace!(harness, "waker.drop");
harness.drop_reference();
}
unsafe fn wake_by_val<T, S>(ptr: *const ())
where
T: F... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f55b77aaddaed8e48a8c0d81c66da82f12433087 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f55b77aaddaed8e48a8c0d81c66da82f12433087/tokio/src/runtime/task/waker.rs | 81 | 130 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:4 | {
let ptr = header as *const ();
let vtable = &RawWakerVTable::new(
clone_waker::<T, S>,
wake_by_val::<T, S>,
wake_by_ref::<T, S>,
drop_waker::<T, S>,
);
RawWaker::new(ptr, vtable)
} | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | f55b77aaddaed8e48a8c0d81c66da82f12433087 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f55b77aaddaed8e48a8c0d81c66da82f12433087/tokio/src/runtime/task/waker.rs | 121 | 130 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:1 | use crate::future::Future;
use crate::runtime::task::harness::Harness;
use crate::runtime::task::{Header, Schedule};
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops;
use std::ptr::NonNull;
use std::task::{RawWaker, RawWakerVTable, Waker};
pub(super) struct WakerRef<'a, S: 'static> {
waker: ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/waker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/waker.rs:2 | fn deref(&self) -> &Waker {
&self.waker
}
}
cfg_trace! {
macro_rules! trace {
($harness:expr, $op:expr) => {
if let Some(id) = $harness.id() {
tracing::trace!(
target: "tokio::task::waker",
op = %$op,
task.i... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/task/waker.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/task/waker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use super::Config;
use std::marker::PhantomData;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
#[allow(dead_code)]
pub(crate) fn from_config(config: &Config) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task_hooks.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:2 | pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate) task_terminate_callback: Option<TaskCallback>,
#[cfg(tokio_unstable)]
pub(crate) before_poll_callback: Option<TaskCallback>,
#[cfg(tokio_unstable)]
pub(crate) after_poll_callback: Option<TaskCallback>,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task_hooks.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use std::marker::PhantomData;
use std::panic::Location;
use super::Config;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
#[allow(dead_code)]
pub(crate) fn from_config(config: &Config) -> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task_hooks.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:2 | #[derive(Clone)]
pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate) task_terminate_callback: Option<TaskCallback>,
#[cfg(tokio_unstable)]
pub(crate) before_poll_callback: Option<TaskCallback>,
#[cfg(tokio_unstable)]
pub(crate) after_poll_callback: Opti... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task_hooks.rs | 41 | 84 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use std::marker::PhantomData;
use super::Config;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
#[allow(dead_code)]
pub(crate) fn from_config(config: &Config) -> Self {
Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task_hooks.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:2 | _phantom: std::marker::PhantomData,
})
}
}
}
#[derive(Clone)]
pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate) task_terminate_callback: Option<TaskCallback>,
#[cfg(tokio_unstable)]
pub(crate) before_poll_callback: Option<TaskCallback... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task_hooks.rs | 41 | 81 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use std::marker::PhantomData;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
}
#[derive(Clone)]
pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | c032ea02030b55ef3b16000cd3f51d19009469da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/task_hooks.rs | 1 | 41 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use std::marker::PhantomData;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
}
#[derive(Clone)]
pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | 5ada5114df1e36de2b748e3ea26a196a0e097f47 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5ada5114df1e36de2b748e3ea26a196a0e097f47/tokio/src/runtime/task_hooks.rs | 1 | 35 |
tokio-rs/tokio:tokio/src/runtime/task_hooks.rs:1 | use std::marker::PhantomData;
impl TaskHooks {
pub(crate) fn spawn(&self, meta: &TaskMeta<'_>) {
if let Some(f) = self.task_spawn_callback.as_ref() {
f(meta)
}
}
}
#[derive(Clone)]
pub(crate) struct TaskHooks {
pub(crate) task_spawn_callback: Option<TaskCallback>,
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task_hooks.rs | MIT | b37f0de28a17ced6a9e6738062770d6fea8c5364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/task_hooks.rs | 1 | 36 |
tokio-rs/tokio:tokio/src/runtime/tests/inject.rs:1 | use crate::runtime::scheduler::inject;
#[test]
fn push_and_pop() {
const N: usize = 2;
let (inject, mut synced) = inject::Shared::new();
for i in 0..N {
assert_eq!(inject.len(), i);
let (task, _) = super::unowned(async {});
unsafe { inject.push(&mut synced, task) };
}
for... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/inject.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/tests/inject.rs | 1 | 54 |
tokio-rs/tokio:tokio/src/runtime/tests/inject.rs:1 | use crate::runtime::scheduler::Inject;
#[test]
fn push_and_pop() {
let inject = Inject::new();
for _ in 0..10 {
let (task, _) = super::unowned(async {});
inject.push(task);
}
for _ in 0..10 {
assert!(inject.pop().is_some());
}
assert!(inject.pop().is_none());
}
#[tes... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/inject.rs | MIT | a8b6353535ffa08fc84aee93d315ec4df088c2c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8b6353535ffa08fc84aee93d315ec4df088c2c2/tokio/src/runtime/tests/inject.rs | 1 | 38 |
tokio-rs/tokio:tokio/src/runtime/tests/inject.rs:1 | use crate::runtime::task::Inject;
#[test]
fn push_and_pop() {
let inject = Inject::new();
for _ in 0..10 {
let (task, _) = super::unowned(async {});
inject.push(task);
}
for _ in 0..10 {
assert!(inject.pop().is_some());
}
assert!(inject.pop().is_none());
}
#[test]
fn... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/inject.rs | MIT | 3a94eb089343e1efa9563b91e13c79a0e61b2364 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3a94eb089343e1efa9563b91e13c79a0e61b2364/tokio/src/runtime/tests/inject.rs | 1 | 38 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use crate::loom::thread;
use crate::runtime::{Builder, Runtime};
use crate::sync::oneshot::{self, Receiver};
use crate::task;
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::Ordering::{Acquire, Release};
use std::task::{Context, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | e951d55720689ae5058d8af97a71a66d063f87cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/src/runtime/tests/loom_basic_scheduler.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:2 | // - when we fail to steal the parker and we block on a notification
// that it is available.
//
// - when we steal the parker and we schedule the future
//
// - when the future is woken up and we have ran the max number of tasks
// for the current tick or there are n... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | e951d55720689ae5058d8af97a71a66d063f87cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/src/runtime/tests/loom_basic_scheduler.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:3 | });
let pending_cnt_clone = pending_cnt.clone();
rt.block_on(async move {
// use task::yield_now() to ensure woken set to true
// ResetFuture will be polled at most once
// Here comes two cases
// 1. recv no message from channel, ResetFuture will be polle... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | e951d55720689ae5058d8af97a71a66d063f87cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/src/runtime/tests/loom_basic_scheduler.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:4 | }
}
}
struct ResetFuture {
rx: Receiver<()>,
pending_cnt: Arc<AtomicUsize>,
}
impl Future for ResetFuture {
type Output = ();
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
match Pin::new(&mut self.rx).poll(cx) {
Poll::Pending => {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | e951d55720689ae5058d8af97a71a66d063f87cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e951d55720689ae5058d8af97a71a66d063f87cd/tokio/src/runtime/tests/loom_basic_scheduler.rs | 121 | 142 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use crate::loom::thread;
use crate::runtime::{Builder, Runtime};
use crate::sync::oneshot::{self, Receiver};
use crate::task;
use std::future::Future;
use std::pin::Pin;
use std::sync::atomic::Ordering::{Acquire, Release};
use std::task::{Context, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | 867f137dc98ec41e7480d7f56158c3e7758b1a7e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/867f137dc98ec41e7480d7f56158c3e7758b1a7e/tokio/src/runtime/tests/loom_basic_scheduler.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:2 | // - when we fail to steal the parker and we block on a
// notification that it is available.
//
// - when we steal the parker and we schedule the future
//
// - when the future is woken up and we have ran the max
// number of tasks for the current tick or there are n... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | 867f137dc98ec41e7480d7f56158c3e7758b1a7e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/867f137dc98ec41e7480d7f56158c3e7758b1a7e/tokio/src/runtime/tests/loom_basic_scheduler.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/tests/loom_basic_scheduler.rs:3 | let pending_cnt_clone = pending_cnt.clone();
rt.block_on(async move {
// use task::yield_now() to ensure woken set to true
// ResetFuture will be polled at most once
// Here comes two cases
// 1. recv no message from channel, ResetFuture will be polled
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/runtime/tests/loom_basic_scheduler.rs | MIT | 867f137dc98ec41e7480d7f56158c3e7758b1a7e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/867f137dc98ec41e7480d7f56158c3e7758b1a7e/tokio/src/runtime/tests/loom_basic_scheduler.rs | 81 | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.