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/list.rs:1 | //! This module has containers for storing the tasks spawned on a scheduler. The
//! `OwnedTasks` container is thread-safe but can only store tasks that
//! implement Send. The `LocalOwnedTasks` container is not thread safe, but can
//! store non-Send tasks.
//!
//! The collections can be closed to prevent adding new t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:2 | cfg_not_has_atomic_u64! {
use std::sync::atomic::{AtomicU32, Ordering};
static NEXT_OWNED_TASKS_ID: AtomicU32 = AtomicU32::new(1);
fn get_next_id() -> u64 {
loop {
let id = NEXT_OWNED_TASKS_ID.fetch_add(1, Ordering::Relaxed);
if id != 0 {
return u64::from(id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:3 | /// Binds the provided task to this OwnedTasks instance. This fails if the
/// OwnedTasks has been closed.
pub(crate) fn bind<T>(
&self,
task: T,
scheduler: S,
id: super::Id,
) -> (JoinHandle<T::Output>, Option<Notified<S>>)
where
S: Schedule,
T: Future + ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | // to poll it on this thread no matter what thread we are on.
LocalNotified {
task: task.0,
_not_send: PhantomData,
}
}
/// Shuts down all tasks in the collection. This call also closes the
/// collection, preventing new items from being added.
pub(crate) fn clos... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:5 | }
assert_eq!(task_id, self.id);
// safety: We just checked that the provided task is not in some other
// linked list.
unsafe { self.inner.lock().list.remove(task.header_ptr()) }
}
pub(crate) fn is_empty(&self) -> bool {
self.inner.lock().list.is_empty()
}
}
impl<... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:6 | // safety: We just created the task, so we have exclusive access
// to the field.
task.header().set_owner_id(self.id);
}
if self.is_closed() {
drop(notified);
task.shutdown();
(join, None)
} else {
self.with_inner(|inner| {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:7 | // safety: We just checked that the provided task is not in some
// other linked list.
unsafe { inner.list.remove(task.header_ptr()) })
}
/// Asserts that the given task is owned by this LocalOwnedTasks and convert
/// it to a LocalNotified, giving the thread permission to poll this... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 241 | 299 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:8 | #[cfg(all(test))]
mod tests {
use super::*;
// This test may run in parallel with other tests, so we only test that ids
// come in increasing order.
#[test]
fn test_id_not_broken() {
let mut last_id = get_next_id();
assert_ne!(last_id, 0);
for _ in 0..1000 {
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | ca9dd726b1c00736faa72df1885831545306a0a5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ca9dd726b1c00736faa72df1885831545306a0a5/tokio/src/runtime/task/list.rs | 281 | 299 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:6 | // safety: We just created the task, so we have exclusive access
// to the field.
task.header().set_owner_id(self.id);
}
if self.is_closed() {
drop(notified);
task.shutdown();
(join, None)
} else {
self.with_inner(|inner| {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:7 | // safety: We just checked that the provided task is not in some
// other linked list.
unsafe { inner.list.remove(task.header().into()) })
}
/// Asserts that the given task is owned by this LocalOwnedTasks and convert
/// it to a LocalNotified, giving the thread permission to poll t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 228d4fce992124fc646a2e49606a65847166413c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/228d4fce992124fc646a2e49606a65847166413c/tokio/src/runtime/task/list.rs | 241 | 299 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | // to poll it on this thread no matter what thread we are on.
LocalNotified {
task: task.0,
_not_send: PhantomData,
}
}
/// Shuts down all tasks in the collection. This call also closes the
/// collection, preventing new items from being added.
pub(crate) fn clos... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:5 | }
assert_eq!(task_id, self.id);
// safety: We just checked that the provided task is not in some other
// linked list.
unsafe { self.inner.lock().list.remove(task.header().into()) }
}
pub(crate) fn is_empty(&self) -> bool {
self.inner.lock().list.is_empty()
}
}
im... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/task/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:2 | cfg_not_has_atomic_u64! {
use std::sync::atomic::{AtomicU32, Ordering};
static NEXT_OWNED_TASKS_ID: AtomicU32 = AtomicU32::new(1);
fn get_next_id() -> u64 {
loop {
let id = NEXT_OWNED_TASKS_ID.fetch_add(1, Ordering::Relaxed);
if id != 0 {
return u64::from(id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:3 | /// Binds the provided task to this OwnedTasks instance. This fails if the
/// OwnedTasks has been closed.
pub(crate) fn bind<T>(
&self,
task: T,
scheduler: S,
) -> (JoinHandle<T::Output>, Option<Notified<S>>)
where
S: Schedule,
T: Future + Send + 'static,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | LocalNotified {
task: task.0,
_not_send: PhantomData,
}
}
/// Shuts down all tasks in the collection. This call also closes the
/// collection, preventing new items from being added.
pub(crate) fn close_and_shutdown_all(&self)
where
S: Schedule,
{
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:5 | assert_eq!(task_id, self.id);
// safety: We just checked that the provided task is not in some other
// linked list.
unsafe { self.inner.lock().list.remove(task.header().into()) }
}
pub(crate) fn is_empty(&self) -> bool {
self.inner.lock().list.is_empty()
}
}
impl<S: 'stat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:6 | task.header().set_owner_id(self.id);
}
if self.is_closed() {
drop(notified);
task.shutdown();
(join, None)
} else {
self.with_inner(|inner| {
inner.list.push_front(task);
});
(join, Some(notified))
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:7 | unsafe { inner.list.remove(task.header().into()) })
}
/// Asserts that the given task is owned by this LocalOwnedTasks and convert
/// it to a LocalNotified, giving the thread permission to poll this task.
#[inline]
pub(crate) fn assert_owner(&self, task: Notified<S>) -> LocalNotified<S> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 241 | 297 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:8 | use super::*;
// This test may run in parallel with other tests, so we only test that ids
// come in increasing order.
#[test]
fn test_id_not_broken() {
let mut last_id = get_next_id();
assert_ne!(last_id, 0);
for _ in 0..1000 {
let next_id = get_next_id();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/task/list.rs | 281 | 297 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:2 | cfg_not_has_atomic_u64! {
use std::sync::atomic::{AtomicU32, Ordering};
static NEXT_OWNED_TASKS_ID: AtomicU32 = AtomicU32::new(1);
fn get_next_id() -> u64 {
loop {
let id = NEXT_OWNED_TASKS_ID.fetch_add(1, Ordering::Relaxed);
if id != 0 {
return u64::from(id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:3 | /// Bind the provided task to this OwnedTasks instance. This fails if the
/// OwnedTasks has been closed.
pub(crate) fn bind<T>(
&self,
task: T,
scheduler: S,
) -> (JoinHandle<T::Output>, Option<Notified<S>>)
where
S: Schedule,
T: Future + Send + 'static,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | LocalNotified {
task: task.0,
_not_send: PhantomData,
}
}
/// Shut down all tasks in the collection. This call also closes the
/// collection, preventing new items from being added.
pub(crate) fn close_and_shutdown_all(&self)
where
S: Schedule,
{
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:5 | assert_eq!(task_id, self.id);
// safety: We just checked that the provided task is not in some other
// linked list.
unsafe { self.inner.lock().list.remove(task.header().into()) }
}
pub(crate) fn is_empty(&self) -> bool {
self.inner.lock().list.is_empty()
}
}
impl<S: 'stat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:6 | task.header().set_owner_id(self.id);
}
if self.is_closed() {
drop(notified);
task.shutdown();
(join, None)
} else {
self.with_inner(|inner| {
inner.list.push_front(task);
});
(join, Some(notified))
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:7 | unsafe { inner.list.remove(task.header().into()) })
}
/// Assert that the given task is owned by this LocalOwnedTasks and convert
/// it to a LocalNotified, giving the thread permission to poll this task.
#[inline]
pub(crate) fn assert_owner(&self, task: Notified<S>) -> LocalNotified<S> {
a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/runtime/task/list.rs | 241 | 297 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:1 | //! This module has containers for storing the tasks spawned on a scheduler. The
//! `OwnedTasks` container is thread-safe but can only store tasks that
//! implement Send. The `LocalOwnedTasks` container is not thread safe, but can
//! store non-Send tasks.
//!
//! The collections can be closed to prevent adding new t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:2 | use std::sync::atomic::{AtomicU32, Ordering};
static NEXT_OWNED_TASKS_ID: AtomicU32 = AtomicU32::new(1);
fn get_next_id() -> u64 {
loop {
let id = NEXT_OWNED_TASKS_ID.fetch_add(1, Ordering::Relaxed);
if id != 0 {
return u64::from(id);
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:3 | /// Bind the provided task to this OwnedTasks instance. This fails if the
/// OwnedTasks has been closed.
pub(crate) fn bind<T>(
&self,
task: T,
scheduler: S,
) -> (JoinHandle<T::Output>, Option<Notified<S>>)
where
S: Schedule,
T: Future + Send + 'static,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | // to poll it on this thread no matter what thread we are on.
LocalNotified {
task: task.0,
_not_send: PhantomData,
}
}
pub(crate) fn pop_back(&self) -> Option<Task<S>> {
self.inner.lock().list.pop_back()
}
pub(crate) fn remove(&self, task: &Task<S>) -> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:5 | impl<S: 'static> LocalOwnedTasks<S> {
pub(crate) fn new() -> Self {
Self {
list: LinkedList::new(),
closed: false,
id: get_next_id(),
_not_send_or_sync: PhantomData,
}
}
pub(crate) fn bind<T>(
&mut self,
task: T,
schedu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:6 | }
pub(crate) fn remove(&mut self, task: &Task<S>) -> Option<Task<S>> {
let task_id = task.header().get_owner_id();
if task_id == 0 {
// The task is unowned.
return None;
}
assert_eq!(task_id, self.id);
// safety: We just checked that the provided ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:7 | }
#[cfg(all(test))]
mod tests {
use super::*;
// This test may run in parallel with other tests, so we only test that ids
// come in increasing order.
#[test]
fn test_id_not_broken() {
let mut last_id = get_next_id();
assert_ne!(last_id, 0);
for _ in 0..1000 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | f2a06bff1be147a72d40cb01d8bb621fbdc242fc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f2a06bff1be147a72d40cb01d8bb621fbdc242fc/tokio/src/runtime/task/list.rs | 241 | 261 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:1 | //! This module has containers for storing the tasks spawned on a scheduler. The
//! `OwnedTasks` container is thread-safe but can only store tasks that
//! implement Send. The `LocalOwnedTasks` container is not thread safe, but can
//! store non-Send tasks.
//!
//! The collections can be closed to prevent adding new t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:2 | /// OwnedTasks has been closed.
pub(crate) fn bind<T>(
&self,
task: T,
scheduler: S,
) -> (JoinHandle<T::Output>, Option<Notified<S>>)
where
S: Schedule,
T: Future + Send + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = super::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:3 | pub(crate) fn is_closed(&self) -> bool {
self.inner.lock().closed
}
/// Close the OwnedTasks. This prevents adding new tasks to the collection.
pub(crate) fn close(&self) {
self.inner.lock().closed = true;
}
}
impl<S: 'static> LocalOwnedTasks<S> {
pub(crate) fn new() -> Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:4 | pub(crate) fn pop_back(&mut self) -> Option<Task<S>> {
self.list.pop_back()
}
/// The caller must ensure that if the provided task is stored in a
/// linked list, then it is in this linked list.
pub(crate) unsafe fn remove(&mut self, task: &Task<S>) -> Option<Task<S>> {
self.list.remove... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | 2087f3e0ebb08d633d59c5f964b3901e68b3c038 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/task/list.rs | 121 | 141 |
tokio-rs/tokio:tokio/src/runtime/task/list.rs:1 | use crate::loom::sync::Mutex;
use crate::runtime::task::Task;
use crate::util::linked_list::{Link, LinkedList};
pub(crate) struct OwnedTasks<S: 'static> {
list: Mutex<LinkedList<Task<S>, <Task<S> as Link>::Target>>,
}
impl<S: 'static> OwnedTasks<S> {
pub(crate) fn new() -> Self {
Self {
li... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/list.rs | MIT | e2589a0e401e27457618920e66caa0f14e9a69ad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e2589a0e401e27457618920e66caa0f14e9a69ad/tokio/src/runtime/task/list.rs | 1 | 33 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! `JoinHandle` is responsible for cleaning up the output. If the output is not
//! Send, then this happens:
//!
//! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
pub(crate) use self::spawn_location::SpawnLocation;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | #[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
impl<S> Notified<S> {
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
#[inline]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::TaskMeta<'meta> {
self.0.task_meta()
}
}
// safety: This type cannot be used t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<T> = std::result::Result<T, JoinError>;
/// Hooks for scheduling tasks which are needed in the task harness.
#[derive(Clone)]
pub(crate) struct TaskHarnessScheduleHooks {
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | /// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
scheduler: S,
id: Id,
spawned_at: SpawnLocation,
) -> (Task<S>, Notified<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Future + 'static,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | spawned_at: SpawnLocation,
) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = new_task(
task,
scheduler,
id,
spawned_at,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | }
#[cfg(all(
tokio_unstable,
feature = "taskdump",
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn as_raw(&self) -> RawTask {
self.raw
}
fn header(&self) -> &Header {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | #[cfg(tokio_unstable)]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::TaskMeta<'meta> {
crate::runtime::TaskMeta {
id: self.id(),
spawned_at: self.spawned_at().into(),
_phantom: PhantomData,
}
}
cfg_taskdump! {
/// Notify the task for ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | ///
/// [`RawTask::ptr`] must be a valid pointer to a [`Header`].
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(unsafe { Task::new(ptr) })
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
mem::forget(self)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(crate) fn waker_ref(&self) -> waker::WakerRef<'_, S> {
waker::waker_ref::<S>(self.task.raw.header_ptr_ref())
}
}
impl<S: Schedule> UnownedTask<S> {
// Used in test of the inject queue.
#[cfg(test)]
#[cfg_a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | raw.poll();
// Decrement our extra ref-count
drop(task);
}
pub(crate) fn shutdown(self) {
self.into_task().shutdown();
}
}
impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deall... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | }
/// # Safety
///
/// Tasks are pinned.
unsafe impl<S> linked_list::Link for Task<S> {
type Handle = Task<S>;
type Target = Header;
fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
unsafe { Task::from... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:17 | use std::panic::Location;
#[derive(Copy, Clone)]
pub(crate) struct SpawnLocation(pub &'static Location<'static>);
impl From<&'static Location<'static>> for SpawnLocation {
fn from(location: &'static Location<'static>) -> Self {
Self(location)
}
}
}
#[cfg(not(tokio_unstable... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/task/mod.rs | 641 | 679 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | ///
/// [`RawTask::ptr`] must be a valid pointer to a [`Header`].
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(unsafe { Task::new(ptr) })
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
mem::forget(self)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 967f5715a71d5d2600b71da8c4ab652c4e644a41 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | fn into_task(self) -> Task<S> {
// Convert into a task.
let task = Task {
raw: self.raw,
_p: PhantomData,
};
mem::forget(self);
// Drop a ref-count since an UnownedTask holds two.
task.header().state.ref_dec();
task
}
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 967f5715a71d5d2600b71da8c4ab652c4e644a41 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | // Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.raw.header().state.ref_dec_twice() {
// Deallocate if this is the final ref count
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 967f5715a71d5d2600b71da8c4ab652c4e644a41 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/task/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | unsafe { Task::from_raw(ptr) }
}
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
unsafe { self::core::Trailer::addr_of_owned(Header::get_trailer(target)) }
}
}
/// # Safety
///
/// The id of a task is never changed after creation of the task, so the return v... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 967f5715a71d5d2600b71da8c4ab652c4e644a41 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/task/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:17 | use std::panic::Location;
#[derive(Copy, Clone)]
pub(crate) struct SpawnLocation();
impl From<&'static Location<'static>> for SpawnLocation {
fn from(_: &'static Location<'static>) -> Self {
Self()
}
}
#[cfg(test)]
#[test]
fn spawn_location_is_zero_sized() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 967f5715a71d5d2600b71da8c4ab652c4e644a41 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/task/mod.rs | 641 | 665 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! `JoinHandle` is responsible for cleaning up the output. If the output is not
//! Send, then this happens:
//!
//! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
#[cfg(feature = "rt-multi-thread")]
mod atomic_notified;
#[cfg(feature = "rt-multi-thread")]
pub(crate) use self::atomic_notified::Atomic... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified.
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
impl<S> Notified<S> {
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
#[inline]
pub(crate) fn task_meta<'meta>(&self) -> crate::runt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | raw: RawTask,
_p: PhantomData<S>,
}
// safety: This type can only be created given a Send task.
unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<T> = std::result::Result<T, JoinError>;
/// Hooks for scheduling tasks which are ne... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | }
cfg_rt! {
/// This is the constructor for a new task. Three references to the task are
/// created. The first task reference is usually put into an `OwnedTasks`
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
sche... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | /// Currently only blocking tasks use this method.
pub(crate) fn unowned<T, S>(
task: T,
scheduler: S,
id: Id,
spawned_at: SpawnLocation,
) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | /// # Safety
///
/// `ptr` must be a valid pointer to a [`Header`].
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
unsafe { Task::new(RawTask::from_raw(ptr)) }
}
#[cfg(all(
tokio_unstable,
feature = "taskdump",
feature = "rt",
target_os = "linux",
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | }
// Explicit `'task` and `'meta` lifetimes are necessary here, as otherwise,
// the compiler infers the lifetimes to be the same, and considers the task
// to be borrowed for the lifetime of the returned `TaskMeta`.
#[cfg(tokio_unstable)]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::Ta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | }
}
impl<S: 'static> Notified<S> {
/// # Safety
///
/// [`RawTask::ptr`] must be a valid pointer to a [`Header`].
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(unsafe { Task::new(ptr) })
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | #[cfg(test)]
#[cfg_attr(target_family = "wasm", allow(dead_code))]
pub(super) fn into_notified(self) -> Notified<S> {
Notified(self.into_task())
}
fn into_task(self) -> Task<S> {
// Convert into a task.
let task = Task {
raw: self.raw,
_p: PhantomData,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | impl<S: 'static> Drop for Task<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | fn as_raw(handle: &Task<S>) -> NonNull<Header> {
handle.raw.header_ptr()
}
unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
unsafe { Task::from_raw(ptr) }
}
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
unsafe { self::core::Trailer... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:17 | }
}
#[cfg(not(tokio_unstable))]
mod spawn_location {
use std::panic::Location;
#[derive(Copy, Clone)]
pub(crate) struct SpawnLocation();
impl From<&'static Location<'static>> for SpawnLocation {
fn from(_: &'static Location<'static>) -> Self {
Self()
}
}
#[cfg(tes... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/eeb55c733ba9a83c51d08b1629dca6a5ec0f4b2b/tokio/src/runtime/task/mod.rs | 641 | 670 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! `JoinHandle` is responsible for cleaning up the output. If the output is not
//! Send, then this happens:
//!
//! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
pub(crate) use self::spawn_location::SpawnLocation;
cfg_taskdump! {
pub(crate) mod trace;
}
use crate::future::Future;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | /// A task was notified.
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
impl<S> Notified<S> {
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
#[inline]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::TaskMeta<'meta> {
self.0.task_meta()
}
}
// safety: T... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:8 | // safety: This type can only be created given a Send task.
unsafe impl<S> Send for UnownedTask<S> {}
unsafe impl<S> Sync for UnownedTask<S> {}
/// Task result sent back.
pub(crate) type Result<T> = std::result::Result<T, JoinError>;
/// Hooks for scheduling tasks which are needed in the task harness.
#[derive(Clone)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:9 | /// created. The first task reference is usually put into an `OwnedTasks`
/// immediately. The Notified is sent to the scheduler as an ordinary
/// notification.
fn new_task<T, S>(
task: T,
scheduler: S,
id: Id,
spawned_at: SpawnLocation,
) -> (Task<S>, Notified<S>, JoinH... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | id: Id,
spawned_at: SpawnLocation,
) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'static,
{
let (task, notified, join) = new_task(
task,
scheduler,
id,
spaw... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe { Task::new(RawTask::from_raw(ptr)) }
}
#[cfg(all(
tokio_unstable,
feature = "taskdump",
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(super) fn as_raw(&self) -> RawTask {
sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // to be borrowed for the lifetime of the returned `TaskMeta`.
#[cfg(tokio_unstable)]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::TaskMeta<'meta> {
crate::runtime::TaskMeta {
id: self.id(),
spawned_at: self.spawned_at().into(),
_phantom: PhantomData,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | /// # Safety
///
/// [`RawTask::ptr`] must be a valid pointer to a [`Header`].
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(unsafe { Task::new(ptr) })
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | }
fn into_task(self) -> Task<S> {
// Convert into a task.
let task = Task {
raw: self.raw,
_p: PhantomData,
};
mem::forget(self);
// Drop a ref-count since an UnownedTask holds two.
task.header().state.ref_dec();
task
}
pub(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | if self.header().state.ref_dec() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.raw.header().state.ref_dec_twice() {
// Deallo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
unsafe { Task::from_raw(ptr) }
}
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
unsafe { self::core::Trailer::addr_of_owned(Header::get_trailer(target)) }
}
}
/// # Safety
///
/// The id of a tas... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:17 | mod spawn_location {
use std::panic::Location;
#[derive(Copy, Clone)]
pub(crate) struct SpawnLocation();
impl From<&'static Location<'static>> for SpawnLocation {
fn from(_: &'static Location<'static>) -> Self {
Self()
}
}
#[cfg(test)]
#[test]
fn spawn_loca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 426a56278017c30e7da7b4c9365a2610f4695f76 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/426a56278017c30e7da7b4c9365a2610f4695f76/tokio/src/runtime/task/mod.rs | 641 | 666 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! `JoinHandle` is responsible for cleaning up the output. If the output is not
//! Send, then this happens:
//!
//! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | mod join;
#[cfg(feature = "rt")]
pub use self::abort::AbortHandle;
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
pub(crate) use self::spawn_location::SpawnLocation;
cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | /// Currently only blocking tasks use this method.
pub(crate) fn unowned<T, S>(
task: T,
scheduler: S,
id: Id,
spawned_at: SpawnLocation,
) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,
feature = "taskdump",
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // the compiler infers the lifetimes to be the same, and considers the task
// to be borrowed for the lifetime of the returned `TaskMeta`.
#[cfg(tokio_unstable)]
pub(crate) fn task_meta<'meta>(&self) -> crate::runtime::TaskMeta<'meta> {
crate::runtime::TaskMeta {
id: self.id(),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:13 | impl<S: 'static> Notified<S> {
pub(crate) unsafe fn from_raw(ptr: RawTask) -> Notified<S> {
Notified(Task::new(ptr))
}
}
impl<S: 'static> Notified<S> {
pub(crate) fn into_raw(self) -> RawTask {
let raw = self.0.raw;
mem::forget(self);
raw
}
}
impl<S: Schedule> Task<S> {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:14 | fn into_task(self) -> Task<S> {
// Convert into a task.
let task = Task {
raw: self.raw,
_p: PhantomData,
};
mem::forget(self);
// Drop a ref-count since an UnownedTask holds two.
task.header().state.ref_dec();
task
}
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:15 | self.raw.dealloc();
}
}
}
impl<S: 'static> Drop for UnownedTask<S> {
fn drop(&mut self) {
// Decrement the ref count
if self.raw.header().state.ref_dec_twice() {
// Deallocate if this is the final ref count
self.raw.dealloc();
}
}
}
impl<S> fmt::Debu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:16 | }
unsafe fn pointers(target: NonNull<Header>) -> NonNull<linked_list::Pointers<Header>> {
self::core::Trailer::addr_of_owned(Header::get_trailer(target))
}
}
/// # Safety
///
/// The id of a task is never changed after creation of the task, so the return value of
/// `get_shard_id` will not change. (T... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:17 | #[derive(Copy, Clone)]
pub(crate) struct SpawnLocation();
impl From<&'static Location<'static>> for SpawnLocation {
fn from(_: &'static Location<'static>) -> Self {
Self()
}
}
#[cfg(test)]
#[test]
fn spawn_location_is_zero_sized() {
assert_eq!(std::mem::size... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | d1f1499f630c34c1d319acdc2cc86d7a1008c4b4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f1499f630c34c1d319acdc2cc86d7a1008c4b4/tokio/src/runtime/task/mod.rs | 641 | 664 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:10 | /// Currently only blocking tasks use this method.
pub(crate) fn unowned<T, S>(
task: T,
scheduler: S,
id: Id,
spawned_at: SpawnLocation,
) -> (UnownedTask<S>, JoinHandle<T::Output>)
where
S: Schedule,
T: Send + Future + 'static,
T::Output: Send + 'sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 0922aa2a0b09cf35582f15c799996c64e0b6e50a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/task/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,
tokio_taskdump,
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(sup... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 0922aa2a0b09cf35582f15c799996c64e0b6e50a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:6 | mod join;
#[cfg(feature = "rt")]
pub use self::abort::AbortHandle;
pub use self::join::JoinHandle;
mod list;
pub(crate) use self::list::{LocalOwnedTasks, OwnedTasks};
mod raw;
pub(crate) use self::raw::RawTask;
mod state;
use self::state::State;
mod waker;
pub(crate) use self::spawn_location::SpawnLocation;
cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a0d5b8ab308bbeaa8090d411550d6c887d699096 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/task/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:7 | unsafe impl<S> Send for Task<S> {}
unsafe impl<S> Sync for Task<S> {}
/// A task was notified.
#[repr(transparent)]
pub(crate) struct Notified<S: 'static>(Task<S>);
impl<S> Notified<S> {
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
#[inline]
pub(crate) fn task_meta<'task, 'meta>(&'task self) -... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a0d5b8ab308bbeaa8090d411550d6c887d699096 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/task/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,
tokio_taskdump,
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(sup... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a0d5b8ab308bbeaa8090d411550d6c887d699096 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // the compiler infers the lifetimes to be the same, and considers the task
// to be borrowed for the lifetime of the returned `TaskMeta`.
#[cfg(tokio_unstable)]
pub(crate) fn task_meta<'task, 'meta>(&'task self) -> crate::runtime::TaskMeta<'meta> {
crate::runtime::TaskMeta {
id: self.id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | a0d5b8ab308bbeaa8090d411550d6c887d699096 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a0d5b8ab308bbeaa8090d411550d6c887d699096/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:11 | unsafe fn from_raw(ptr: NonNull<Header>) -> Task<S> {
Task::new(RawTask::from_raw(ptr))
}
#[cfg(all(
tokio_unstable,
tokio_taskdump,
feature = "rt",
target_os = "linux",
any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64")
))]
pub(sup... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:12 | // the compiler infers the lifetimes to be the same, and considers the task
// to be borrowed for the lifetime of the returned `TaskMeta`.
#[cfg(tokio_unstable)]
pub(crate) fn task_meta<'task, 'meta>(&'task self) -> crate::runtime::TaskMeta<'meta> {
crate::runtime::TaskMeta {
id: self.id... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | 3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3e890cc0171ddb210acdcfec831b7c7bcbb0d2d9/tokio/src/runtime/task/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/task/mod.rs:5 | //! `JoinHandle` is responsible for cleaning up the output. If the output is not
//! Send, then this happens:
//!
//! 1. The output is created on the thread that the future was polled on. Since
//! only non-Send futures can have non-Send output, the future was polled on
//! the thread that the future was spawn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/task/mod.rs | MIT | b8ac94ed70df22f885bad7ea3c0ff51c536bad4a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/task/mod.rs | 161 | 220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.