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/sync/broadcast.rs:18 | // Because a receiver is lagging, this slot also holds the
// oldest value. To make the positions match, we subtract the
// capacity.
let next = tail.pos.wrapping_sub(self.shared.buffer.len() as u64);
let missed = next.wrapping_sub(self.next);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:19 | ///
/// [`recv`]: crate::sync::broadcast::Receiver::recv
/// [`Receiver`]: crate::sync::broadcast::Receiver
///
/// # Examples
///
/// ```
/// use tokio::sync::broadcast;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, mut rx) = broadcast::channel(16);
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:21 | /// tx.send(20).unwrap();
/// }
/// ```
///
/// Handling lag
///
/// ```
/// use tokio::sync::broadcast;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, mut rx) = broadcast::channel(2);
///
/// tx.send(10).unwrap();
/// tx.send(20).unwrap... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:22 | // The ref count is decremented in `notify_rx` when all nodes are
// removed from the waiter stack.
let node = Arc::into_raw(self.wait.clone()) as *mut _;
loop {
// Safety: `queued == false` means the caller has exclusive
// access to `self.wait.next`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:23 | }
impl<T> Drop for Receiver<T> {
fn drop(&mut self) {
let mut tail = self.shared.tail.lock().unwrap();
tail.rx_cnt -= 1;
let until = tail.pos;
drop(tail);
while self.next != until {
match self.recv_ref(true) {
// Ignore the value
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:24 | write!(fmt, "broadcast::Sender")
}
}
impl<T> fmt::Debug for Receiver<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "broadcast::Receiver")
}
}
impl<T> Slot<T> {
/// Try to lock the slot for a receiver. If `false`, then a sender holds the
/// lock and the call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:25 | }
let prev = self.lock.fetch_sub(2, SeqCst);
if prev & 1 == 1 {
// Sender waiting for lock
condvar.notify_one();
}
}
}
impl<'a, T> RecvGuard<'a, T> {
fn pos(&self) -> u64 {
self.slot.write.pos.with(|ptr| unsafe { *ptr })
}
fn clone_value(&self)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | a8540948254ec69c630bacd0b4a58a20d701b7ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a8540948254ec69c630bacd0b4a58a20d701b7ac/tokio/src/sync/broadcast.rs | 961 | 1,006 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:6 | /// implying that the message could never be received. The error contains the
/// message being sent as a payload so it can be recovered.
#[derive(Debug)]
pub struct SendError<T>(pub T);
/// An error returned from the [`recv`] function on a [`Receiver`].
///
/// [`recv`]: crate::sync::broadcast::Receiver::recv
/// [`R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/broadcast.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:22 | // The ref count is decremented in `notify_rx` when all nodes are
// removed from the waiter stack.
let node = Arc::into_raw(self.wait.clone()) as *mut _;
loop {
// Safety: `queued == false` means the caller has exclusive
// access to `self.wait.next`... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/broadcast.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:23 | // Can't be empty
Err(TryRecvError::Empty) => panic!("unexpected empty broadcast channel"),
}
}
}
}
impl<T> Drop for Shared<T> {
fn drop(&mut self) {
// Clear the wait stack
let mut curr = *self.wait_stack.get_mut() as *const WaitNode;
while !curr.is... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/broadcast.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:24 | // Locked by sender
return false;
}
// Only increment (by 2) if the LSB "lock" bit is not set.
let res = self.lock.compare_exchange(curr, curr + 2, SeqCst, SeqCst);
match res {
Ok(_) => return true,
Err(actual) => curr = a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/broadcast.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:25 | {
self.slot.write.val.with(|ptr| unsafe { (*ptr).clone() })
}
fn drop_no_rem_dec(self) {
use std::mem;
self.slot.rx_unlock(self.condvar, false);
mem::forget(self);
}
}
impl<'a, T> Drop for RecvGuard<'a, T> {
fn drop(&mut self) {
self.slot.rx_unlock(self.condva... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/sync/broadcast.rs | 961 | 987 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:10 | /// });
///
/// tx.send(10).unwrap();
/// tx.send(20).unwrap();
/// }
/// ```
pub fn channel<T>(mut capacity: usize) -> (Sender<T>, Receiver<T>) {
assert!(capacity > 0, "capacity is empty");
assert!(capacity <= usize::MAX >> 1, "requested capacity too large");
// Round to a power of two
cap... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:11 | next: 0,
wait: Arc::new(WaitNode {
queued: AtomicBool::new(false),
waker: AtomicWaker::new(),
next: CausalCell::new(ptr::null()),
}),
};
let tx = Sender {
shared,
};
(tx, rx)
}
unsafe impl<T: Send> Send for Sender<T> {}
unsafe impl<T: Send> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:13 | /// # Examples
///
/// ```
/// use tokio::sync::broadcast;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, _rx) = broadcast::channel(16);
///
/// // Will not be seen
/// tx.send(10).unwrap();
///
/// let mut rx = tx.subscribe();
///
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:14 | next: CausalCell::new(ptr::null()),
}),
}
}
/// Returns the number of active receivers
///
/// An active receiver is a [`Receiver`] handle returned from [`channel`] or
/// [`subscribe`]. These are the handles that will receive values sent on
/// this [`Sender`].
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:15 | /// ```
pub fn receiver_count(&self) -> usize {
let tail = self.shared.tail.lock().unwrap();
tail.rx_cnt
}
fn send2(&self, value: Option<T>) -> Result<usize, SendError<Option<T>>> {
let mut tail = self.shared.tail.lock().unwrap();
if tail.rx_cnt == 0 {
return Er... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:16 | // Set remaining receivers
slot.rem.store(rem, SeqCst);
// Release the slot lock
slot.lock.store(0, SeqCst);
// Notify waiting receivers
self.notify_rx();
Ok(rem)
}
fn notify_rx(&self) {
let mut curr = self.shared.wait_stack.swap(ptr::null_mut(), SeqCs... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:17 | impl<T> Drop for Sender<T> {
fn drop(&mut self) {
if 1 == self.shared.num_tx.fetch_sub(1, SeqCst) {
let _ = self.send2(None);
}
}
}
impl<T> Receiver<T> {
/// Lock the next value if there is one.
///
/// The caller is responsible for unlocking
fn recv_ref(&mut self, s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:18 | return Err(TryRecvError::Empty);
} else {
let tail = self.shared.tail.lock().unwrap();
// `tail.pos` points to the slot the **next** send writes to.
// Because a receiver is lagging, this slot also holds the
// oldest value. To make the positi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:19 | /// will return with `Err(TryRecvError::Lagged)` and the [`Receiver`]'s
/// internal cursor is updated to point to the oldest value still held by
/// the channel. A subsequent call to [`try_recv`] will return this value
/// **unless** it has been since overwritten. If there are no values to
/// receive,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:21 | /// assert_eq!(rx2.recv().await.unwrap(), 10);
/// assert_eq!(rx2.recv().await.unwrap(), 20);
/// });
///
/// tx.send(10).unwrap();
/// tx.send(20).unwrap();
/// }
/// ```
///
/// Handling lag
///
/// ```
/// use tokio::sync::broadcast;
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:22 | // Set `queued` before queuing.
self.wait.queued.store(true, SeqCst);
let mut curr = self.shared.wait_stack.load(SeqCst);
// The ref count is decremented in `notify_rx` when all nodes are
// removed from the waiter stack.
let node = Arc::into_raw(self.wait.c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:23 | // Ignore lagging, we will catch up
Err(TryRecvError::Lagged(..)) => {}
// Can't be empty
Err(TryRecvError::Empty) => panic!("unexpected empty broadcast channel"),
}
}
}
}
impl<T> Drop for Shared<T> {
fn drop(&mut self) {
// Clear the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:24 | loop {
if curr & 1 == 1 {
// Locked by sender
return false;
}
// Only increment (by 2) if the LSB "lock" bit is not set.
let res = self.lock.compare_exchange(curr, curr + 2, SeqCst, SeqCst);
match res {
Ok(_) =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/broadcast.rs:25 | where
T: Clone,
{
self.slot.write.val.with(|ptr| unsafe { (*ptr).clone() })
}
fn drop_no_rem_dec(self) {
use std::mem;
self.slot.rx_unlock(self.condvar, false);
mem::forget(self);
}
}
impl<'a, T> Drop for RecvGuard<'a, T> {
fn drop(&mut self) {
sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/broadcast.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/broadcast.rs | 961 | 989 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:2 | /// 99
/// }
/// }
/// });
///
/// tokio::spawn(async move {
/// tokio::time::delay_for(std::time::Duration::from_millis(10)).await;
/// token.cancel();
/// });
///
/// assert_eq!(5, join_handle.await.unwrap());
/// }
/// ```
pub struct CancellationTok... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:3 | impl core::fmt::Debug for CancellationToken {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("CancellationToken")
.field("is_cancelled", &self.is_cancelled())
.finish()
}
}
impl Clone for CancellationToken {
fn clone(&self) -> Self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:4 | // If this was the last reference, unregister from the parent
if current_state.refcount == 0 {
if let Some(mut parent) = parent {
// Safety: Since we still retain a reference on the parent, it must be valid.
let parent = unsafe { parent.as_mut() };
par... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:5 | /// If the current token is already cancelled, the child token will get
/// returned in cancelled state.
///
/// # Examples
///
/// ```ignore
/// use tokio::select;
/// use tokio::scope::CancellationToken;
///
/// #[tokio::main]
/// async fn main() {
/// let token = Cance... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:6 | // not.
let _current_state = inner.increment_refcount(inner.snapshot());
let mut unpacked_child_state = StateSnapshot {
has_parent_ref: true,
refcount: 1,
cancel_state: CancellationState::NotCancelled,
};
let mut child_token_state = Box::new(Cancellat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:7 | };
let child_token_ptr = Box::into_raw(child_token_state);
// Safety: We just created the pointer from a `Box`
CancellationToken {
inner: unsafe { NonNull::new_unchecked(child_token_ptr) },
}
}
/// Cancel the [`CancellationToken`] and all child tokens which had been... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:8 | &self,
wait_node: &mut ListNode<WaitQueueEntry>,
cx: &mut Context<'_>,
) -> Poll<()> {
self.state().check_for_cancellation(wait_node, cx)
}
fn unregister(&self, wait_node: &mut ListNode<WaitQueueEntry>) {
self.state().unregister(wait_node)
}
}
// ===== impl WaitForCance... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:9 | if let Poll::Ready(()) = poll_res {
// The cancellation_token was signalled
mut_self.cancellation_token = None;
// A signalled Token means the Waker won't be enqueued anymore
mut_self.is_registered = false;
mut_self.wait_node.task = None;
} else {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:10 | /// Tracks the WaitForCancellationFuture waiting state.
/// Access to this struct is synchronized through the mutex in the CancellationToken.
struct WaitQueueEntry {
/// The task handle of the waiting task
task: Option<Waker>,
// Current polling state. This state is only updated inside the Mutex of
// t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:11 | prev_peer: Option<NonNull<CancellationTokenState>>,
}
/// Possible states of a `CancellationToken`
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum CancellationState {
NotCancelled = 0,
Cancelling = 1,
Cancelled = 2,
}
impl CancellationState {
fn pack(self) -> usize {
self as usize
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:12 | /// Packs the snapshot into a `usize`
fn pack(self) -> usize {
self.refcount << 3 | if self.has_parent_ref { 4 } else { 0 } | self.cancel_state.pack()
}
/// Unpacks the snapshot from a `usize`
fn unpack(value: usize) -> Self {
let refcount = value >> 3;
let has_parent_ref = valu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:13 | state: StateSnapshot,
) -> CancellationTokenState {
CancellationTokenState {
parent,
from_parent: SynchronizedThroughParent {
prev_peer: None,
next_peer: None,
},
state: AtomicUsize::new(state.pack()),
synchronized: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:14 | }
fn increment_refcount(&self, current_state: StateSnapshot) -> StateSnapshot {
self.atomic_update_state(current_state, |mut state: StateSnapshot| {
if state.refcount >= MAX_REFS as usize {
eprintln!("[ERROR] Maximum reference count for CancellationToken was exceeded");
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:15 | }
current_state
}
/// Unregisters a child from the parent token.
/// The child tokens state is not exactly known at this point in time.
/// If the parent token is cancelled, the child token gets removed from the
/// parents list, and might therefore already have been freed. If the parent
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:16 | child_state.from_parent.prev_peer = None;
child_state.from_parent.next_peer = None;
// The child is no longer referenced by the parent, since we were able
// to remove its reference from the parents list.
true
} else {
// Do no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:17 | return;
}
let mut next_state = current_state;
next_state.cancel_state = CancellationState::Cancelling;
match self.state.compare_exchange(
current_state.pack(),
next_state.pack(),
Ordering::SeqCst,
Ordering::... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:18 | // If we would access waiters outside of the lock, the pointers
// may no longer be valid.
// Typically this shouldn't be an issue, since waking a task should
// only move it from the blocked into the ready state and not have
// further side effects.
// Use a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:19 | // This is ONLY allowed once we promised not to touch the state anymore
// after this interaction.
mut_child.remove_parent_ref(mut_child.snapshot());
}
// The cancellation has completed
// At this point in time tasks which registered a wait node can be sure
// th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:20 | // So far the token is not cancelled. However it could be cancelld before
// we get the chance to store the `Waker`. Therfore we need to check
// for cancellation again inside the mutex.
let mut guard = self.synchronized.lock().unwrap();
if guard.is_cancelled {
// Cancellatio... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:21 | Poll::Ready(())
} else {
// Check if we need to swap the `Waker`. This will make the check more
// expensive, since the `Waker` is synchronized through the Mutex.
// If we don't need to perform a `Waker` update, an atomic check for
// cancellation is sufficient.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:22 | wait_node.task.is_some(),
"waiter can not be active without task"
);
let mut guard = self.synchronized.lock().unwrap();
// WaitForCancellationFuture only needs to get removed if it has been added to
// the wait queue of the CancellationToken.
// This has happened in ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 264ae3bdb22004609de45b67e2890081bb47e5b2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/264ae3bdb22004609de45b67e2890081bb47e5b2/tokio/src/sync/cancellation_token.rs | 841 | 861 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:1 | //! An asynchronously awaitable `CancellationToken`.
//! The token allows to signal a cancellation request to one or more tasks.
use crate::{
loom::sync::{atomic::AtomicUsize, Mutex},
util::intrusive_double_linked_list::{LinkedList, ListNode},
};
use core::{
future::Future,
pin::Pin,
ptr::NonNull,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:2 | /// }
/// _ = tokio::time::delay_for(std::time::Duration::from_secs(9999)) => {
/// 99
/// }
/// }
/// });
///
/// tokio::spawn(async move {
/// tokio::time::delay_for(std::time::Duration::from_millis(10)).await;
/// token.cancel();
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:3 | inner.increment_refcount(current_state);
CancellationToken { inner: self.inner }
}
}
impl Drop for CancellationToken {
fn drop(&mut self) {
let token_state_pointer = self.inner;
// Safety: The state inside a `CancellationToken` is always valid, since
// is reference counted
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:4 | StateSnapshot {
cancel_state: CancellationState::NotCancelled,
has_parent_ref: false,
refcount: 1,
},
));
// Safety: We just created the Box. The pointer is guaranteed to be
// not null
CancellationToken {
inner: un... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:5 | /// select! {
/// _ = child_token.cancelled() => {
/// // The token was cancelled
/// 5
/// }
/// _ = tokio::time::delay_for(std::time::Duration::from_secs(9999)) => {
/// 99
/// }
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:6 | if guard.is_cancelled {
// This task was already cancelled. In this case we should not
// insert the child into the list, since it would never get removed
// from the list.
(*child_token_state.synchronized.lock().unwrap()).is_cancelled = true;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:7 | let guard = inner.synchronized.lock().unwrap();
let mut child = guard.first_child;
while let Some(mut c) = child {
result += 1;
// Safety: The child state is accessed from within a Mutex. Since
// the child needs to take the Mutex to unregister itself before
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:8 | ) -> Poll<()> {
self.state().register(wait_node, cx)
}
fn check_for_cancellation(
&self,
wait_node: &mut ListNode<WaitQueueEntry>,
cx: &mut Context<'_>,
) -> Poll<()> {
self.state().check_for_cancellation(wait_node, cx)
}
fn unregister(&self, wait_node: &mut... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:9 | impl<'a> Future for WaitForCancellationFuture<'a> {
type Output = ();
fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<()> {
// Safety: We do not move anything out of `WaitForCancellationFuture`
let mut_self: &mut WaitForCancellationFuture<'_> = unsafe { Pin::get_unchecked_mut(self) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:10 | // Otherwise the cancellation_token would access invalid memory.
if let Some(token) = self.cancellation_token {
if self.is_registered {
token.unregister(&mut self.wait_node);
}
}
}
}
/// Tracks how the future had interacted with the [`CancellationToken`]
#[de... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:11 | struct SynchronizedState {
waiters: LinkedList<WaitQueueEntry>,
first_child: Option<NonNull<CancellationTokenState>>,
is_cancelled: bool,
}
impl SynchronizedState {
fn new() -> Self {
Self {
waiters: LinkedList::new(),
first_child: None,
is_cancelled: false,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:12 | 2 => CancellationState::Cancelled,
_ => unreachable!("Invalid value"),
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct StateSnapshot {
/// The amount of references to this particular CancellationToken.
/// `CancellationToken` structs hold these references to a `CancellationTok... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:13 | fn has_refs(&self) -> bool {
self.refcount != 0 || self.has_parent_ref
}
}
/// The maximum permitted amount of references to a CancellationToken. This
/// is derived from the intent to never use more than 32bit in the `Snapshot`.
const MAX_REFS: u32 = (std::u32::MAX - 7) >> 3;
/// Internal state of the `C... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:14 | F: Fn(StateSnapshot) -> StateSnapshot,
{
let mut current_packed_state = current_state.pack();
loop {
let next_state = func(current_state);
match self.state.compare_exchange(
current_packed_state,
next_state.pack(),
Ordering::Seq... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:15 | if !current_state.has_refs() {
// Safety: `CancellationTokenState` is always stored in refcounted
// Boxes
let _ = unsafe { Box::from_raw(self as *const Self as *mut Self) };
}
current_state
}
fn remove_parent_ref(&self, current_state: StateSnapshot) -> Stat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:16 | // still be in the list and valid.
let mut child_state = unsafe { child_state.as_mut() };
debug_assert!(child_state.snapshot().has_parent_ref);
if guard.first_child == Some(child_state.into()) {
guard.first_child = child_state.from_parent.next_peer;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:17 | // the the parent ref status. If it is isn't able to do so, because the
// parent removed it from the list, there is no need to do this.
// The parent ref acts as as another reference count. Therefore
// removing this reference can free the object.
// Safety: The token wa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:18 | // child tasks would have additional child tokens, we would recursively
// take locks.
// Doing this action has an impact if the child token is dropped concurrently:
// It will try to deregister itself from the parent task, but can not find
// itself in the task list anymore. Therefore ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:19 | guard.first_child.take()
};
while let Some(mut child) = first_child {
// Safety: We know this is a valid pointer since it is in our child pointer
// list. It can't have been freed in between, since we retain a a reference
// to each child.
let mut_child =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:20 | /// Registers a waiting task at the `CancellationToken`.
/// Safety: This method is only safe as long as the waiting waiting task
/// will properly unregister the wait node before it gets moved.
unsafe fn register(
&self,
wait_node: &mut ListNode<WaitQueueEntry>,
cx: &mut Context<'_>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:21 | cx: &mut Context<'_>,
) -> Poll<()> {
debug_assert!(
wait_node.task.is_some(),
"Method can only be called after task had been registered"
);
let current_state = self.snapshot();
if current_state.cancel_state != CancellationState::NotCancelled {
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:22 | Poll::Ready(())
} else {
// The WaitForCancellationFuture is already in the queue.
// The CancellationToken can't have been cancelled,
// since this would change the is_cancelled flag inside the mutex.
// Therefore we just h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:23 | }
#[cfg(all(test, not(loom)))]
mod tests {
use super::*;
use crate::pin;
use futures_test::task::new_count_waker;
#[test]
fn cancel_token() {
let (waker, wake_counter) = new_count_waker();
let token = CancellationToken::new();
assert_eq!(false, token.is_cancelled());
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:24 | #[test]
fn cancel_child_token_through_parent() {
let (waker, wake_counter) = new_count_waker();
let token = CancellationToken::new();
let child_token = token.child_token();
assert_eq!(
StateSnapshot {
refcount: 1,
has_parent_ref: true,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:25 | child_token.state().snapshot()
);
assert_eq!(
Poll::Ready(()),
child_fut.as_mut().poll(&mut Context::from_waker(&waker))
);
assert_eq!(
Poll::Ready(()),
parent_fut.as_mut().poll(&mut Context::from_waker(&waker))
);
}
#[tes... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:26 | StateSnapshot {
refcount: 1,
has_parent_ref: true,
cancel_state: CancellationState::Cancelled,
},
child_token_1.state().snapshot()
);
assert_eq!(
Poll::Ready(()),
child_fut.as_mut().poll(&mut Context::from_w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:27 | Poll::Ready(()),
parent_fut.as_mut().poll(&mut Context::from_waker(&waker))
);
}
#[test]
fn create_child_token_after_parent_was_cancelled() {
for drop_child_first in [true, false].iter().cloned() {
let (waker, wake_counter) = new_count_waker();
let token ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:28 | }
if drop_child_first {
drop(child_token);
drop(token);
} else {
drop(token);
drop(child_token);
}
}
}
#[test]
fn drop_multiple_child_tokens() {
for drop_first_child_first in &[true, false] ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:29 | for i in 0..child_tokens.len() {
if *drop_first_child_first {
child_tokens[i] = None;
} else {
child_tokens[child_tokens.len() - 1 - i] = None;
}
remaining_childs -= 1;
assert_eq!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/cancellation_token.rs:30 | }
#[test]
fn parent_refcoutn_only_decreases_if_all_child_clones_are_released() {
let token = CancellationToken::new();
let child1 = token.child_token();
let child2 = child1.clone();
assert_eq!(2, token.state().snapshot().refcount);
drop(child1);
assert_eq!(2, t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/cancellation_token.rs | MIT | 187af2e6a323be4193c82ad95f9aa32d2ae16869 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/187af2e6a323be4193c82ad95f9aa32d2ae16869/tokio/src/sync/cancellation_token.rs | 1,161 | 1,186 |
tokio-rs/tokio:tokio/src/sync/loom.rs:1 | #[cfg(not(all(test, loom)))]
mod imp {
pub(crate) mod future {
pub(crate) use crate::sync::task::AtomicWaker;
}
pub(crate) mod sync {
pub(crate) use std::sync::atomic;
pub(crate) use std::sync::Arc;
use std::cell::UnsafeCell;
pub(crate) struct CausalCell<T>(UnsafeC... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/loom.rs | MIT | 2b909d6805990abf0bc2a5dea9e7267ff87df704 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2b909d6805990abf0bc2a5dea9e7267ff87df704/tokio/src/sync/loom.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! basic abstractions for doing so:
//!
//! - [oneshot](oneshot/inde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 32e15b3a24ac177c92a78eb04e233534583eae17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32e15b3a24ac177c92a78eb04e233534583eae17/tokio/src/sync/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mod.rs:2 | pub mod watch;
}
cfg_not_sync! {
cfg_atomic_waker_impl! {
mod task;
pub(crate) use task::AtomicWaker;
}
#[cfg(any(
feature = "rt-core",
feature = "process",
feature = "signal"))]
pub(crate) mod oneshot;
cfg_signal! {
pub(crate) mod mpsc;... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 32e15b3a24ac177c92a78eb04e233534583eae17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32e15b3a24ac177c92a78eb04e233534583eae17/tokio/src/sync/mod.rs | 41 | 64 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! basic abstractions for doing so:
//!
//! - [oneshot](oneshot/inde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mod.rs:2 | cfg_not_sync! {
cfg_atomic_waker_impl! {
mod task;
pub(crate) use task::AtomicWaker;
}
#[cfg(any(
feature = "rt-core",
feature = "process",
feature = "signal"))]
pub(crate) mod oneshot;
cfg_signal! {
pub(crate) mod mpsc;
pub(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 7c010ed030d0084d38451bbebf727c6695c2dbac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7c010ed030d0084d38451bbebf727c6695c2dbac/tokio/src/sync/mod.rs | 41 | 61 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! basic abstractions for doing so:
//!
//! - [oneshot](oneshot/inde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 9211adbe01661585cd1831214279262024d04816 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9211adbe01661585cd1831214279262024d04816/tokio/src/sync/mod.rs | 1 | 59 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! basic abstractions for doing so:
//!
//! - [oneshot](oneshot/inde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 74d33a1b2f69bfcb4f00befd4f9f5ec9649e70de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/74d33a1b2f69bfcb4f00befd4f9f5ec9649e70de/tokio/src/sync/mod.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 38e602f4d812c196d5dc0bc245e79ccad4e77cfd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/sync/mod.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/src/sync/mod.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | #![cfg_attr(loom, allow(dead_code, unreachable_pub, unused_imports))]
//! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/sync/mod.rs | 1 | 55 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | //! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/index.html), a way of sending a single value
//! from one task to ano... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | d4fec2c5d628b180226f6ab3005aa3e5845f1929 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4fec2c5d628b180226f6ab3005aa3e5845f1929/tokio/src/sync/mod.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | //! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/index.html), a way of sending a single value
//! from one task to ano... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/src/sync/mod.rs | 1 | 53 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | //! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/index.html), a way of sending a single value
//! from one task to ano... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | c147be04374534cf7062ea5e7062c4767ba0e2f7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c147be04374534cf7062ea5e7062c4767ba0e2f7/tokio/src/sync/mod.rs | 1 | 56 |
tokio-rs/tokio:tokio/src/sync/mod.rs:1 | //! Future-aware synchronization
//!
//! This module is enabled with the **`sync`** feature flag.
//!
//! Tasks sometimes need to communicate with each other. This module contains
//! two basic abstractions for doing so:
//!
//! - [oneshot](oneshot/index.html), a way of sending a single value
//! from one task to ano... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/sync/mod.rs | MIT | a6253ed05a1e0d14bc64915f5937c29092df9497 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a6253ed05a1e0d14bc64915f5937c29092df9497/tokio/src/sync/mod.rs | 1 | 56 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:1 | use crate::loom::cell::UnsafeCell;
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use std::alloc::Layout;
use std::mem::MaybeUninit;
use std::ops;
use std::ptr::{self, NonNull};
use std::sync::atomic::Ordering::{self, AcqRel, Acquire, Release};
/// A block in a linked list.
///
/// Each block in the list ca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:2 | pub(crate) enum Read<T> {
Value(T),
Closed,
}
#[repr(transparent)]
struct Values<T>([UnsafeCell<MaybeUninit<T>>; BLOCK_CAP]);
use super::BLOCK_CAP;
/// Masks an index to get the block identifier.
const BLOCK_MASK: usize = !(BLOCK_CAP - 1);
/// Masks an index to get the value offset in a block.
const SLOT_MA... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:3 | generate_addr_of_methods! {
impl<T> Block<T> {
unsafe fn addr_of_header(self: NonNull<Self>) -> NonNull<BlockHeader<T>> {
&self.header
}
unsafe fn addr_of_values(self: NonNull<Self>) -> NonNull<Values<T>> {
&self.values
}
}
}
impl<T> Block<T> {
pub(c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:4 | // Convert the pointer to a `Box`.
// Safety: The raw pointer was allocated using the global allocator, and with
// the layout for a `Block<T>`, so it's valid to convert it to box.
Box::from_raw(block.as_ptr())
}
}
/// Returns `true` if the block matches the given in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:5 | return None;
}
// Get the value
//
// Safety:
//
// 1. The caller guarantees that there is no concurrent access to the slot.
// 2. The `UnsafeCell` always give us a valid pointer to the value.
let value = self.values[offset].with(|ptr| unsafe { ptr::read(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:6 | pub(crate) unsafe fn write(&self, slot_index: usize, value: T) {
// Get the offset into the block
let slot_offset = offset(slot_index);
self.values[slot_offset].with_mut(|ptr| {
// Safety: the caller guarantees that there is no concurrent access to the slot
unsafe {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:7 | /// more senders will attempt to access the block.
///
/// # Safety
///
/// To maintain safety, the caller must ensure:
///
/// * The block will no longer be accessed by any sender.
pub(crate) unsafe fn tx_release(&self, tail_position: usize) {
// Track the observed tail_position. An... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:8 | if 0 == RELEASED & self.header.ready_slots.load(Acquire) {
None
} else {
Some(
self.header
.observed_tail_position
.with(|ptr| unsafe { *ptr }),
)
}
}
/// Loads the next block
pub(crate) fn load_next... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/block.rs:9 | pub(crate) unsafe fn try_push(
&self,
block: &mut NonNull<Block<T>>,
success: Ordering,
failure: Ordering,
) -> Result<(), NonNull<Block<T>>> {
// Safety: caller guarantees that `block` is valid.
unsafe { block.as_mut() }.header.start_index =
self.header.s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/block.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/block.rs | 321 | 380 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.