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/mpsc/error.rs:1 | //! Channel error types.
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(PartialEq, Eq, Clone, Copy)]
pub struct SendError<T>(pub T);
impl<T> fmt::Debug for SendError<T> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("SendError").finish_non_e... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 61b68a8abc7e6824f31eaa51e4b41e00a5471d20 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/61b68a8abc7e6824f31eaa51e4b41e00a5471d20/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types.
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 3652f71ade9caa07378ac0225a198e83207f4213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3652f71ade9caa07378ac0225a198e83207f4213/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== TryRecvError =====
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 3652f71ade9caa07378ac0225a198e83207f4213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3652f71ade9caa07378ac0225a198e83207f4213/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | #[derive(Debug, Clone)]
#[doc(hidden)]
#[deprecated(note = "This type is unused because recv returns an Option.")]
pub struct RecvError(());
#[allow(deprecated)]
impl fmt::Display for RecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
#[allow(dep... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 3652f71ade9caa07378ac0225a198e83207f4213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3652f71ade9caa07378ac0225a198e83207f4213/tokio/src/sync/mpsc/error.rs | 81 | 125 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== TryRecvError =====
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | b1afd95994be0d46ea70ba784439a684a787f50e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1afd95994be0d46ea70ba784439a684a787f50e/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | #[derive(Debug)]
#[doc(hidden)]
#[deprecated(note = "This type is unused because recv returns an Option.")]
pub struct RecvError(());
#[allow(deprecated)]
impl fmt::Display for RecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
#[allow(deprecated... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | b1afd95994be0d46ea70ba784439a684a787f50e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1afd95994be0d46ea70ba784439a684a787f50e/tokio/src/sync/mpsc/error.rs | 81 | 125 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types.
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== TryRecvError =====
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | #[derive(Debug)]
#[doc(hidden)]
#[deprecated(note = "This type is unused because recv returns an Option.")]
pub struct RecvError(());
#[allow(deprecated)]
impl fmt::Display for RecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
#[allow(deprecated... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/error.rs | 81 | 125 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | cb147a2b3fa3fa8eb76803c8438bf501d8d43e29 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb147a2b3fa3fa8eb76803c8438bf501d8d43e29/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | cb147a2b3fa3fa8eb76803c8438bf501d8d43e29 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb147a2b3fa3fa8eb76803c8438bf501d8d43e29/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | /// The receive half of the channel was explicitly closed or has been
/// dropped.
Closed(T),
}
impl<T: fmt::Debug> Error for SendTimeoutError<T> {}
impl<T> fmt::Display for SendTimeoutError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | cb147a2b3fa3fa8eb76803c8438bf501d8d43e29 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb147a2b3fa3fa8eb76803c8438bf501d8d43e29/tokio/src/sync/mpsc/error.rs | 81 | 101 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/error.rs | 41 | 97 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | }
impl<T: fmt::Debug> Error for SendTimeoutError<T> {}
impl<T> fmt::Display for SendTimeoutError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
SendTimeoutError::Timeout(.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | e4f76688a00fa2ce81ab6c074700995095c29e1e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/error.rs | 81 | 97 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | ce0e9c67cfe61c7a91a284331ecc53fa01c32879 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | /// never be any more data received on it.
Closed,
}
impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
TryRecvError::Empty => "channel ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | ce0e9c67cfe61c7a91a284331ecc53fa01c32879 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mpsc/error.rs | 81 | 130 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:4 | fmt,
"{}",
match self {
SendTimeoutError::Timeout(..) => "timed out waiting on send operation",
SendTimeoutError::Closed(..) => "channel closed",
}
)
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | ce0e9c67cfe61c7a91a284331ecc53fa01c32879 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ce0e9c67cfe61c7a91a284331ecc53fa01c32879/tokio/src/sync/mpsc/error.rs | 121 | 130 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 575938d4579e6fe6a89b700aadb0ae2bbab5483b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 575938d4579e6fe6a89b700aadb0ae2bbab5483b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | /// The channel's sending half has been closed, and there will
/// never be any more data received on it.
Closed,
}
impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 575938d4579e6fe6a89b700aadb0ae2bbab5483b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mpsc/error.rs | 81 | 131 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:4 | write!(
fmt,
"{}",
match self {
SendTimeoutError::Timeout(..) => "timed out waiting on send operation",
SendTimeoutError::Closed(..) => "channel closed",
}
)
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 575938d4579e6fe6a89b700aadb0ae2bbab5483b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/575938d4579e6fe6a89b700aadb0ae2bbab5483b/tokio/src/sync/mpsc/error.rs | 121 | 131 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
TryRecvError::Empty => "channel empty",
TryRecvError::Closed => "channel closed",
}
)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | cf025ba45f68934ae2138bb75ee2a5ee50506d1b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/error.rs | 81 | 126 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 8118f8f117a5b544f3bc6b3ce4e639a2a605afcb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8118f8f117a5b544f3bc6b3ce4e639a2a605afcb/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
TryRecvError::Empty => "channel empty",
TryRecvError::Closed => "channel closed",
}
)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 8118f8f117a5b544f3bc6b3ce4e639a2a605afcb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8118f8f117a5b544f3bc6b3ce4e639a2a605afcb/tokio/src/sync/mpsc/error.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:4 | /// Error returned by [`Sender::send_timeout`](super::Sender::send_timeout)].
pub enum SendTimeoutError<T> {
/// The data could not be sent on the channel because the channel is
/// full, and the timeout to send has elapsed.
Timeout(T),
/// The receive half of the channel was explic... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 8118f8f117a5b544f3bc6b3ce4e639a2a605afcb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8118f8f117a5b544f3bc6b3ce4e639a2a605afcb/tokio/src/sync/mpsc/error.rs | 121 | 146 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | b9cc032d3bcf7686f0130163c13d3d660d30ae2c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b9cc032d3bcf7686f0130163c13d3d660d30ae2c/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
TryRecvError::Empty => "channel empty",
TryRecvError::Closed => "channel closed",
}
)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | b9cc032d3bcf7686f0130163c13d3d660d30ae2c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b9cc032d3bcf7686f0130163c13d3d660d30ae2c/tokio/src/sync/mpsc/error.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:3 | impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
fmt,
"{}",
match self {
TryRecvError::Empty => "channel empty",
TryRecvError::Closed => "channel closed",
}
)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/mpsc/error.rs | 81 | 115 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | dcfa895b512e3ed522b81b18baf3e33fd78a600c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dcfa895b512e3ed522b81b18baf3e33fd78a600c/tokio/src/sync/mpsc/error.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:1 | //! Channel error types
use std::error::Error;
use std::fmt;
/// Error returned by the `Sender`.
#[derive(Debug)]
pub struct SendError<T>(pub T);
impl<T> fmt::Display for SendError<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "channel closed")
}
}
impl<T: fmt::Debug>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 975576952f33c64e4faaa616f67ae9d6b596e4aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/975576952f33c64e4faaa616f67ae9d6b596e4aa/tokio/src/sync/mpsc/error.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/error.rs:2 | TrySendError::Full(..) => "no available capacity",
TrySendError::Closed(..) => "channel closed",
}
)
}
}
impl<T> From<SendError<T>> for TrySendError<T> {
fn from(src: SendError<T>) -> TrySendError<T> {
TrySendError::Closed(src.0)
}
}
// ===== RecvError =====
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/error.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/src/sync/mpsc/error.rs | 41 | 86 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use crate::loom::thread;
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle.
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | /// returned, and the close state needs to be handled by `chan.rs`.
Empty,
/// The channel is empty and closed.
///
/// Returned when the send half is closed (all senders dropped).
Closed,
/// The channel is not empty, but the first value is being written.
Busy,
}
pub(crate) fn channel<T>()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:3 | unsafe {
// Write the value to the block
block.as_ref().write(slot_index, value);
}
}
/// Closes the send half of the list.
///
/// Similar process as pushing a value, but instead of writing the value &
/// setting the ready flag, the `TX_CLOSED` flag is set on the b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:4 | // contention.
//
// When set, as the routine walks the linked list, it attempts to update
// `block_tail`. If the update cannot be performed, `try_updating_tail`
// is unset.
let mut try_updating_tail = distance > offset;
// Walk the linked list of blocks until the bloc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | if self
.block_tail
.compare_exchange(block_ptr, next_block.as_ptr(), Release, Relaxed)
.is_ok()
{
// Synchronize with any senders
let tail_position = self.tail_position.fetch_add(0, Release);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | // First, reset the data
//
// Safety: caller guarantees the block is valid and not in any list.
unsafe {
block.as_mut().reclaim();
}
let mut reused = false;
// Attempt to insert the block at the end
//
// Walk at most three times
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | }
}
impl<T> fmt::Debug for Tx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Tx")
.field("block_tail", &self.block_tail.load(Relaxed))
.field("tail_position", &self.tail_position.load(Relaxed))
.finish()
}
}
impl<T> Rx<T> {
p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | // time it is in `block_tail`. However, this isn't always the case since it's possible
// that the list was grown with an empty block, in which case `block_tail` points one block
// too far. To handle this case, we walk the list from the head.
let mut block_ptr = Some(self.head);
while ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | // Advance `head`, if needed
if !self.try_advancing_head() {
return None;
}
self.reclaim_blocks(tx);
unsafe {
let block = self.head.as_ref();
let ret = block.read(self.index);
if let Some(block::Read::Value(..)) = ret {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | /// Tries advancing the block pointer to the block referenced by `self.index`.
///
/// Returns `true` if successful, `false` if there is no next block to load.
fn try_advancing_head(&mut self) -> bool {
let block_index = block::start_index(self.index);
loop {
let next_block = {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:11 | Some(i) => i,
None => return,
};
if required_index > self.index {
return;
}
// We may read the next pointer with `Relaxed` ordering as it is
// guaranteed that the `reclaim_blocks` routine trails th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 401 | 457 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:12 | while let Some(block) = cur {
cur = unsafe { block.as_ref() }.load_next(Relaxed);
drop(unsafe { Box::from_raw(block.as_ptr()) });
}
}
}
impl<T> fmt::Debug for Rx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Rx")
.field("... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/sync/mpsc/list.rs | 441 | 457 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | if self
.block_tail
.compare_exchange(block_ptr, next_block.as_ptr(), Release, Relaxed)
.is_ok()
{
// Synchronize with any senders
let tail_position = self.tail_position.fetch_add(0, Release);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | // Walk at most three times
//
let curr_ptr = self.block_tail.load(Acquire);
// The pointer can never be null
debug_assert!(!curr_ptr.is_null());
let mut curr = NonNull::new_unchecked(curr_ptr);
// TODO: Unify this logic with Block::grow
for _ in 0..3 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | if block.has_value(self.index) {
return false;
}
// It is possible that a block has no value "now" but the list is still not empty.
// To be sure, it is necessary to check the length of the list.
self.len(tx) == 0
}
// Guaranteed to return true if `slot_index` is th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | }
pub(crate) fn len(&self, tx: &Tx<T>) -> usize {
let tail_position = tx.tail_position.load(Acquire);
let mut len = tail_position.wrapping_sub(self.index);
debug_assert!(0 <= len as isize);
if len == 0 {
return 0;
}
// There are messages present in the qu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | ret
}
}
/// Pops the next value off the queue, detecting whether the block
/// is busy or empty on failure.
///
/// This function exists because `Rx::pop` can return `None` even if the
/// channel's queue contains a message that has been completely written.
/// This can happen if th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | };
let next_block = match next_block {
Some(next_block) => next_block,
None => {
return false;
}
};
self.head = next_block;
thread::yield_now();
}
}
fn reclaim_blocks(&mut self, tx: &T... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:11 | self.free_head = next_block.unwrap();
// Push the emptied block onto the back of the queue, making it
// available to senders.
tx.reclaim_block(block);
}
thread::yield_now();
}
}
/// Effectively `Drop` all the blocks. Should only... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ebf61b45b5184018f00bc666887ebccf3d4fe51b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ebf61b45b5184018f00bc666887ebccf3d4fe51b/tokio/src/sync/mpsc/list.rs | 401 | 442 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | // Walk at most three times
//
let curr_ptr = self.block_tail.load(Acquire);
// The pointer can never be null
debug_assert!(!curr_ptr.is_null());
let mut curr = NonNull::new_unchecked(curr_ptr);
// TODO: Unify this logic with Block::grow
for _ in 0..3 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 484cb52d8d21cb8156decbeba9569651fcc09d0d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | .field("block_tail", &self.block_tail.load(Relaxed))
.field("tail_position", &self.tail_position.load(Relaxed))
.finish()
}
}
impl<T> Rx<T> {
pub(crate) fn is_empty(&self, tx: &Tx<T>) -> bool {
let block = unsafe { self.head.as_ref() };
if block.has_value(self.index) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 484cb52d8d21cb8156decbeba9569651fcc09d0d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | self.index = self.index.wrapping_add(1);
}
ret
}
}
/// Pops the next value off the queue, detecting whether the block
/// is busy or empty on failure.
///
/// This function exists because `Rx::pop` can return `None` even if the
/// channel's queue contains a mes... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 484cb52d8d21cb8156decbeba9569651fcc09d0d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | block.load_next(Acquire)
};
let next_block = match next_block {
Some(next_block) => next_block,
None => {
return false;
}
};
self.head = next_block;
thread::yield_now();
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 484cb52d8d21cb8156decbeba9569651fcc09d0d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/src/sync/mpsc/list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | // Update the free list head
self.free_head = next_block.unwrap();
// Push the emptied block onto the back of the queue, making it
// available to senders.
tx.reclaim_block(block);
}
thread::yield_now();
}
}
/// E... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 484cb52d8d21cb8156decbeba9569651fcc09d0d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/484cb52d8d21cb8156decbeba9569651fcc09d0d/tokio/src/sync/mpsc/list.rs | 361 | 404 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | // First, reset the data
//
// Safety: caller guarantees the block is valid and not in any list.
unsafe {
block.as_mut().reclaim();
}
let mut reused = false;
// Attempt to insert the block at the end
//
// Walk at most three times
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | }
pub(crate) fn is_closed(&self) -> bool {
let tail = self.block_tail.load(Acquire);
unsafe {
let tail_block = &*tail;
tail_block.is_closed()
}
}
}
impl<T> fmt::Debug for Tx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | /// Pops the next value off the queue.
pub(crate) fn pop(&mut self, tx: &Tx<T>) -> Option<block::Read<T>> {
// Advance `head`, if needed
if !self.try_advancing_head() {
return None;
}
self.reclaim_blocks(tx);
unsafe {
let block = self.head.as_ref();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | }
/// Tries advancing the block pointer to the block referenced by `self.index`.
///
/// Returns `true` if successful, `false` if there is no next block to load.
fn try_advancing_head(&mut self) -> bool {
let block_index = block::start_index(self.index);
loop {
let next_blo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | let required_index = match observed_tail_position {
Some(i) => i,
None => return,
};
if required_index > self.index {
return;
}
// We may read the next pointer with `Relaxed` ordering as it is
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 361 | 419 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:11 | self.head = NonNull::dangling();
}
while let Some(block) = cur {
cur = unsafe { block.as_ref() }.load_next(Relaxed);
drop(unsafe { Box::from_raw(block.as_ptr()) });
}
}
}
impl<T> fmt::Debug for Rx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/665f08b5ad15485e8dcd6c3ec5ad1bda03a2a68d/tokio/src/sync/mpsc/list.rs | 401 | 419 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use crate::loom::thread;
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle.
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | /// The channel is not empty, but the first value is being written.
Busy,
}
pub(crate) fn channel<T>() -> (Tx<T>, Rx<T>) {
// Create the initial block shared between the tx and rx halves.
let initial_block = Block::new(0);
let initial_block_ptr = Box::into_raw(initial_block);
let tx = Tx {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:3 | /// Closes the send half of the list.
///
/// Similar process as pushing a value, but instead of writing the value &
/// setting the ready flag, the `TX_CLOSED` flag is set on the block.
pub(crate) fn close(&self) {
// First, claim a slot for the value. This is the last slot that will be
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:4 | // Walk the linked list of blocks until the block with `start_index` is
// found.
loop {
let block = unsafe { &(*block_ptr) };
if block.is_at_index(start_index) {
return unsafe { NonNull::new_unchecked(block_ptr) };
}
let next_block = blo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | let tail_position = self.tail_position.fetch_add(0, Release);
unsafe {
block.tx_release(tail_position);
}
} else {
// A concurrent sender is also working on advancing
// `block_tail` and this thread ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | let mut curr = NonNull::new_unchecked(curr_ptr);
// TODO: Unify this logic with Block::grow
for _ in 0..3 {
match curr.as_ref().try_push(&mut block, AcqRel, Acquire) {
Ok(()) => {
reused = true;
break;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | impl<T> Rx<T> {
pub(crate) fn is_empty(&self, tx: &Tx<T>) -> bool {
let block = unsafe { self.head.as_ref() };
if block.has_value(self.index) {
return false;
}
// It is possible that a block has no value "now" but the list is still not empty.
// To be sure, it is... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | /// Pops the next value off the queue, detecting whether the block
/// is busy or empty on failure.
///
/// This function exists because `Rx::pop` can return `None` even if the
/// channel's queue contains a message that has been completely written.
/// This can happen if the fully delivered message... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | None => {
return false;
}
};
self.head = next_block;
thread::yield_now();
}
}
fn reclaim_blocks(&mut self, tx: &Tx<T>) {
while self.free_head != self.head {
unsafe {
// Get a handle to the bloc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | tx.reclaim_block(block);
}
thread::yield_now();
}
}
/// Effectively `Drop` all the blocks. Should only be called once, when
/// the list is dropping.
pub(super) unsafe fn free_blocks(&mut self) {
debug_assert_ne!(self.free_head, NonNull::dangling());
le... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 3ce4720a4532e40c78f7d851b1cfb8ea26542177 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3ce4720a4532e40c78f7d851b1cfb8ea26542177/tokio/src/sync/mpsc/list.rs | 361 | 398 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | let mut curr = NonNull::new_unchecked(curr_ptr);
// TODO: Unify this logic with Block::grow
for _ in 0..3 {
match curr.as_ref().try_push(&mut block, AcqRel, Acquire) {
Ok(()) => {
reused = true;
break;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:7 | unsafe {
let block = self.head.as_ref();
let ret = block.read(self.index);
if let Some(block::Read::Value(..)) = ret {
self.index = self.index.wrapping_add(1);
}
ret
}
}
/// Pops the next value off the queue, detecting wheth... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/mpsc/list.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | loop {
let next_block = {
let block = unsafe { self.head.as_ref() };
if block.is_at_index(block_index) {
return true;
}
block.load_next(Acquire)
};
let next_block = match next_block {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/mpsc/list.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | }
// We may read the next pointer with `Relaxed` ordering as it is
// guaranteed that the `reclaim_blocks` routine trails the `recv`
// routine. Any memory accessed by `reclaim_blocks` has already
// been acquired by `recv`.
let next_block... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/mpsc/list.rs | 321 | 371 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:10 | }
impl<T> fmt::Debug for Rx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Rx")
.field("head", &self.head)
.field("index", &self.index)
.field("free_head", &self.free_head)
.finish()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/mpsc/list.rs | 361 | 371 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | /// The channel is not empty, but the first value is being written.
Busy,
}
pub(crate) fn channel<T>() -> (Tx<T>, Rx<T>) {
// Create the initial block shared between the tx and rx halves.
let initial_block = Block::new(0);
let initial_block_ptr = Box::into_raw(initial_block);
let tx = Tx {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 81b50e946fe2f6b30de5e61356ab7cae560956a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/81b50e946fe2f6b30de5e61356ab7cae560956a9/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:3 | /// Closes the send half of the list.
///
/// Similar process as pushing a value, but instead of writing the value &
/// setting the ready flag, the TX_CLOSED flag is set on the block.
pub(crate) fn close(&self) {
// First, claim a slot for the value. This is the last slot that will be
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 81b50e946fe2f6b30de5e61356ab7cae560956a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/81b50e946fe2f6b30de5e61356ab7cae560956a9/tokio/src/sync/mpsc/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | let tail_position = self.tail_position.fetch_add(0, Release);
unsafe {
block.tx_release(tail_position);
}
} else {
// A concurrent sender is also working on advancing
// `block_tail` and this thread ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 81b50e946fe2f6b30de5e61356ab7cae560956a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/81b50e946fe2f6b30de5e61356ab7cae560956a9/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | let mut curr = NonNull::new_unchecked(curr_ptr);
// TODO: Unify this logic with Block::grow
for _ in 0..3 {
match curr.as_ref().try_push(&mut block, AcqRel, Acquire) {
Ok(_) => {
reused = true;
break;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 81b50e946fe2f6b30de5e61356ab7cae560956a9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/81b50e946fe2f6b30de5e61356ab7cae560956a9/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use crate::loom::thread;
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle.
pub(crate) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | /// The channel is not empty, but the first value is being written.
Busy,
}
pub(crate) fn channel<T>() -> (Tx<T>, Rx<T>) {
// Create the initial block shared between the tx and rx halves.
let initial_block = Box::new(Block::new(0));
let initial_block_ptr = Box::into_raw(initial_block);
let tx = Tx... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use crate::loom::thread;
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle
pub(crate) s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | /// The channel is not empty, but the first value is being written.
Busy,
}
pub(crate) fn channel<T>() -> (Tx<T>, Rx<T>) {
// Create the initial block shared between the tx and rx halves.
let initial_block = Box::new(Block::new(0));
let initial_block_ptr = Box::into_raw(initial_block);
let tx = Tx... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:3 | /// Closes the send half of the list
///
/// Similar process as pushing a value, but instead of writing the value &
/// setting the ready flag, the TX_CLOSED flag is set on the block.
pub(crate) fn close(&self) {
// First, claim a slot for the value. This is the last slot that will be
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::sync::atomic::{AtomicPtr, AtomicUsize};
use crate::loom::thread;
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle
pub(crate) s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:2 | };
let head = NonNull::new(initial_block_ptr).unwrap();
let rx = Rx {
head,
index: 0,
free_head: head,
};
(tx, rx)
}
impl<T> Tx<T> {
/// Pushes a value into the list.
pub(crate) fn push(&self, value: T) {
// First, claim a slot for the value. `Acquire` is used... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:3 | unsafe { block.as_ref().tx_close() }
}
fn find_block(&self, slot_index: usize) -> NonNull<Block<T>> {
// The start index of the block that contains `index`.
let start_index = block::start_index(slot_index);
// The index offset into the block
let offset = block::offset(slot_inde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:4 | // There is no allocated next block, grow the linked list.
.unwrap_or_else(|| block.grow());
// If the block is **not** final, then the tail pointer cannot be
// advanced any more.
try_updating_tail &= block.is_final();
if try_updating_tail {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | }
block_ptr = next_block.as_ptr();
thread::yield_now();
}
}
pub(crate) unsafe fn reclaim_block(&self, mut block: NonNull<Block<T>>) {
// The block has been removed from the linked list and ownership
// is reclaimed.
//
// Before dropping the blo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:6 | }
}
}
if !reused {
let _ = Box::from_raw(block.as_ptr());
}
}
}
impl<T> fmt::Debug for Tx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("Tx")
.field("block_tail", &self.block_tail.load(Relaxed))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:8 | let required_index = match observed_tail_position {
Some(i) => i,
None => return,
};
if required_index > self.index {
return;
}
// We may read the next pointer with `Relaxed` ordering as it is
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 281 | 339 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:9 | self.head = NonNull::dangling();
}
while let Some(block) = cur {
cur = block.as_ref().load_next(Relaxed);
drop(Box::from_raw(block.as_ptr()));
}
}
}
impl<T> fmt::Debug for Rx<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_str... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 770044caa70465fbe5d2851a8d9a0bc0e5e7429a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/770044caa70465fbe5d2851a8d9a0bc0e5e7429a/tokio/src/sync/mpsc/list.rs | 321 | 339 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:4 | // There is no allocated next block, grow the linked list.
.unwrap_or_else(|| block.grow());
// If the block is **not** final, then the tail pointer cannot be
// advanced any more.
try_updating_tail &= block.is_final();
if try_updating_tail {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 71da06097bf9aa851ebdde79d7b01a3e38174db9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71da06097bf9aa851ebdde79d7b01a3e38174db9/tokio/src/sync/mpsc/list.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:5 | }
block_ptr = next_block.as_ptr();
thread::yield_now();
}
}
pub(crate) unsafe fn reclaim_block(&self, mut block: NonNull<Block<T>>) {
// The block has been removed from the linked list and ownership
// is reclaimed.
//
// Before dropping the blo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | 71da06097bf9aa851ebdde79d7b01a3e38174db9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/71da06097bf9aa851ebdde79d7b01a3e38174db9/tokio/src/sync/mpsc/list.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/mpsc/list.rs:1 | //! A concurrent, lock-free, FIFO list.
use crate::loom::{
sync::atomic::{AtomicPtr, AtomicUsize},
thread,
};
use crate::sync::mpsc::block::{self, Block};
use std::fmt;
use std::ptr::NonNull;
use std::sync::atomic::Ordering::{AcqRel, Acquire, Relaxed, Release};
/// List queue transmit handle
pub(crate) struc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/mpsc/list.rs | MIT | f9ddb93604a830d106475bd4c4cae436fafcc0da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/sync/mpsc/list.rs | 1 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.