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/oneshot.rs:11 | return Ready(());
} else {
unsafe { inner.tx_task.drop_task() };
}
}
}
if !state.is_tx_task_set() {
// Attempt to set the task
unsafe {
inner.tx_task.set_task(cx);
}
// Updat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | /// ```
/// use tokio::sync::oneshot;
/// use tokio::sync::oneshot::error::TryRecvError;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, mut rx) = oneshot::channel();
///
/// match rx.try_recv() {
/// // The channel is currently empty
/// Err(Try... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | /// }
/// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if state.is_complete() {
match unsafe { inner.consume_value() } {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | let ret = if let Some(inner) = self.as_ref().get_ref().inner.as_ref() {
ready!(inner.poll_recv(cx))?
} else {
panic!("called after complete");
};
self.inner = None;
Ready(Ok(ret))
}
}
impl<T> Inner<T> {
fn complete(&self) -> bool {
let prev = Sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | None => Ready(Err(RecvError(()))),
}
} else if state.is_closed() {
coop.made_progress();
Ready(Err(RecvError(())))
} else {
if state.is_rx_task_set() {
let will_notify = unsafe { self.rx_task.will_wake(cx) };
// Check if th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else {
Pending
}
} else {
Pending
}
}
}
/// Called by `Receiver` to indicate that the value wil... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | if state.is_rx_task_set() {
unsafe {
self.rx_task.drop_task();
}
}
if state.is_tx_task_set() {
unsafe {
self.tx_task.drop_task();
}
}
}
}
impl<T: fmt::Debug> fmt::Debug for Inner<T> {
fn fmt(&self, fmt: &mu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | // the `RX_TASK_SET` flag is set. However, `loom` does not support
// fences yet.
let val = cell.fetch_or(VALUE_SENT, AcqRel);
State(val)
}
fn is_rx_task_set(self) -> bool {
self.0 & RX_TASK_SET == RX_TASK_SET
}
fn set_rx_task(cell: &AtomicUsize) -> State {
let ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | fn is_tx_task_set(self) -> bool {
self.0 & TX_TASK_SET == TX_TASK_SET
}
fn as_usize(self) -> usize {
self.0
}
fn load(cell: &AtomicUsize, order: Ordering) -> State {
let val = cell.load(order);
State(val)
}
}
impl fmt::Debug for State {
fn fmt(&self, fmt: &mut ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 112e160b623e3bef1603bf522abbdaacbc6c94e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/112e160b623e3bef1603bf522abbdaacbc6c94e5/tokio/src/sync/oneshot.rs | 801 | 825 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:11 | return Ready(());
} else {
unsafe { inner.tx_task.drop_task() };
}
}
}
if !state.is_tx_task_set() {
// Attempt to set the task
unsafe {
inner.tx_task.set_task(cx);
}
// Updat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | /// #[tokio::main]
/// async fn main() {
/// let (tx, mut rx) = oneshot::channel();
///
/// match rx.try_recv() {
/// // The channel is currently empty
/// Err(TryRecvError::Empty) => {}
/// _ => unreachable!(),
/// }
///
/// // Send a valu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if state.is_complete() {
match unsafe { inner.consume_value() } {
Some(value) => Ok(value),
None => Err(TryRecvError::Closed),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | };
self.inner = None;
Ready(Ok(ret))
}
}
impl<T> Inner<T> {
fn complete(&self) -> bool {
let prev = State::set_complete(&self.state);
if prev.is_closed() {
return false;
}
if prev.is_rx_task_set() {
// TODO: Consume waker?
u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | Ready(Err(RecvError(())))
} else {
if state.is_rx_task_set() {
let will_notify = unsafe { self.rx_task.will_wake(cx) };
// Check if the task is still the same
if !will_notify {
// Unset the task
state = State::u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | Pending
}
} else {
Pending
}
}
}
/// Called by `Receiver` to indicate that the value will never be received.
fn close(&self) {
let prev = State::set_closed(&self.state);
if prev.is_tx_task_set() && !prev.is_complete() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | }
if state.is_tx_task_set() {
unsafe {
self.tx_task.drop_task();
}
}
}
}
impl<T: fmt::Debug> fmt::Debug for Inner<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use std::sync::atomic::Ordering::Relaxed;
fmt.debug_struc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6f988728bb1b9156b78153461c8632e44cb21a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f988728bb1b9156b78153461c8632e44cb21a21/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:2 | /// Error returned by the `try_recv` function on `Receiver`.
#[derive(Debug, Eq, PartialEq)]
pub enum TryRecvError {
/// The send half of the channel has not yet sent a value.
Empty,
/// The send half of the channel was dropped without sending a value.
Closed,
}
// ====... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:3 | /// The value. This is set by `Sender` and read by `Receiver`. The state of
/// the cell is tracked by `state`.
value: UnsafeCell<Option<T>>,
/// The task to notify when the receiver drops without consuming the value.
tx_task: UnsafeCell<MaybeUninit<Waker>>,
/// The task to notify when the value i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:4 | /// Ok(v) => println!("got = {:?}", v),
/// Err(_) => println!("the sender dropped"),
/// }
/// }
/// ```
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
let inner = Arc::new(Inner {
state: AtomicUsize::new(State::new().as_usize()),
value: UnsafeCell::new(None),
tx_task... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// This function returns:
///
/// * `Poll::Pending` if the channel is still open.
/// * `Poll::Ready(())` if the channel is closed.
///
/// # Examples
///
/// ```
/// use tokio::sync::oneshot;
///
/// use futures::future::poll_fn;
///
/// #[tokio::main]
/// async f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:10 | if !will_notify {
state = State::unset_tx_task(&inner.state);
if state.is_closed() {
// Set the flag again so that the waker is released in drop
State::set_tx_task(&inner.state);
coop.made_progress();
return... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | /// match rx.try_recv() {
/// // The channel will never receive a value.
/// Err(TryRecvError::Closed) => {}
/// _ => unreachable!(),
/// }
/// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result = if let Some(inner) = self.inn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | type Output = Result<T, RecvError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
let ret = if let Some(inner) = self.as_ref().get_ref().inner.as_ref() {
ready!(inner.poll_recv(cx))?
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | if state.is_complete() {
coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else if state.is_closed() {
coop.made_progress();
Ready(Err(R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | if state.is_complete() {
coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else {
Pending
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | }
unsafe fn with_tx_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.tx_task.with(|ptr| {
let waker: *const Waker = (&*ptr).as_ptr();
f(&*waker)
})
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with_mut(|ptr| {
l... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | unsafe impl<T: Send> Send for Inner<T> {}
unsafe impl<T: Send> Sync for Inner<T> {}
impl<T> Drop for Inner<T> {
fn drop(&mut self) {
let state = State(self.state.with_mut(|v| *v));
if state.is_rx_task_set() {
unsafe {
self.drop_rx_task();
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | }
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// TODO: This could be `Release`, followed by an `Acquire` fence *if*
// the `RX_TASK_SET` flag is set. However, `loom` does not support
// fences yet.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | let val = cell.fetch_or(TX_TASK_SET, AcqRel);
State(val | TX_TASK_SET)
}
fn unset_tx_task(cell: &AtomicUsize) -> State {
let val = cell.fetch_and(!TX_TASK_SET, AcqRel);
State(val & !TX_TASK_SET)
}
fn is_tx_task_set(self) -> bool {
self.0 & TX_TASK_SET == TX_TASK_SET
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6d0ba19af51015dcd80558ae768215448e285fdf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d0ba19af51015dcd80558ae768215448e285fdf/tokio/src/sync/oneshot.rs | 801 | 833 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | ///
/// Send a value to another task
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// println!("... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a9da220923bbd329e367ac31de229cc56d470b8d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a9da220923bbd329e367ac31de229cc56d470b8d/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | let coop = ready!(crate::coop::poll_proceed(cx));
let inner = self.inner.as_ref().unwrap();
let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
coop.made_progress();
return Poll::Ready(());
}
if state.is_tx_task_set() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a9da220923bbd329e367ac31de229cc56d470b8d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a9da220923bbd329e367ac31de229cc56d470b8d/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | ///
/// A [`Receiver`] is closed by either calling [`close`] explicitly or the
/// [`Receiver`] value is dropped.
///
/// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: Receiver
/// [`close`]: Receiver::close
///
/// # Examples
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a9da220923bbd329e367ac31de229cc56d470b8d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a9da220923bbd329e367ac31de229cc56d470b8d/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | ///
/// Send a value to another task
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// println!("... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | // Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
let inner = self.inner.as_ref().unwrap();
let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
coop.made_progress();
return Poll::Ready(());
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// Returns `true` if the associated [`Receiver`] handle has been dropped.
///
/// A [`Receiver`] is closed by either calling [`close`] explicitly or the
/// [`Receiver`] value is dropped.
///
/// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | ///
/// match rx.try_recv() {
/// // The channel will never receive a value.
/// Err(TryRecvError::Closed) => {}
/// _ => unreachable!(),
/// }
/// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result = if let Some(inner) = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | impl<T> Future for Receiver<T> {
type Output = Result<T, RecvError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
let ret = if let Some(inner) = self.as_ref().get_ref().inner.as_ref() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | state = State::set_rx_task(&self.state);
if state.is_complete() {
coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | })
}
unsafe fn with_tx_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.tx_task.with(|ptr| {
let waker: *const Waker = (&*ptr).as_ptr();
f(&*waker)
})
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with_mut(|ptr| {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | }
unsafe impl<T: Send> Send for Inner<T> {}
unsafe impl<T: Send> Sync for Inner<T> {}
impl<T> Drop for Inner<T> {
fn drop(&mut self) {
let state = State(self.state.with_mut(|v| *v));
if state.is_rx_task_set() {
unsafe {
self.drop_rx_task();
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | State(0)
}
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// TODO: This could be `Release`, followed by an `Acquire` fence *if*
// the `RX_TASK_SET` flag is set. However, `loom` does not support
// fence... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 496e8899172a39eb8b2cff0f2462141ddc6b575d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/496e8899172a39eb8b2cff0f2462141ddc6b575d/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:3 | /// The value. This is set by `Sender` and read by `Receiver`. The state of
/// the cell is tracked by `state`.
value: UnsafeCell<Option<T>>,
/// The task to notify when the receiver drops without consuming the value.
tx_task: UnsafeCell<MaybeUninit<Waker>>,
/// The task to notify when the value i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:4 | /// Ok(v) => println!("got = {:?}", v),
/// Err(_) => println!("the sender dropped"),
/// }
/// }
/// ```
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
#[allow(deprecated)]
let inner = Arc::new(Inner {
state: AtomicUsize::new(State::new().as_usize()),
value: UnsafeCell::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | /// # Examples
///
/// Send a value to another task
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | pub fn poll_closed(&mut self, cx: &mut Context<'_>) -> Poll<()> {
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
let inner = self.inner.as_ref().unwrap();
let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
coo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// Returns `true` if the associated [`Receiver`] handle has been dropped.
///
/// A [`Receiver`] is closed by either calling [`close`] explicitly or the
/// [`Receiver`] value is dropped.
///
/// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | /// drop(tx);
///
/// match rx.try_recv() {
/// // The channel will never receive a value.
/// Err(TryRecvError::Closed) => {}
/// _ => unreachable!(),
/// }
/// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | impl<T> Future for Receiver<T> {
type Output = Result<T, RecvError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
let ret = if let Some(inner) = self.as_ref().get_ref().inner.as_ref() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | let mut state = State::load(&self.state, Acquire);
if state.is_complete() {
coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else if state.is_closed()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | // Update the state
state = State::set_rx_task(&self.state);
if state.is_complete() {
coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | f(&*waker)
})
}
unsafe fn with_tx_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.tx_task.with(|ptr| {
let waker: *const Waker = (&*ptr).as_ptr();
f(&*waker)
})
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | }
}
unsafe impl<T: Send> Send for Inner<T> {}
unsafe impl<T: Send> Sync for Inner<T> {}
impl<T> Drop for Inner<T> {
fn drop(&mut self) {
let state = State(self.state.with_mut(|v| *v));
if state.is_rx_task_set() {
unsafe {
self.drop_rx_task();
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | fn new() -> State {
State(0)
}
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// TODO: This could be `Release`, followed by an `Acquire` fence *if*
// the `RX_TASK_SET` flag is set. However, `loom` does ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | cf2c05317c348c67a7dbbd9a2d334c39a333980f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf2c05317c348c67a7dbbd9a2d334c39a333980f/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// Returns `true` if the associated [`Receiver`] handle has been dropped.
///
/// A [`Receiver`] is closed by either calling [`close`] explicitly or the
/// [`Receiver`] value is dropped.
///
/// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: R... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 3db22e29d19eba5b2a85e78f4ae8330d3edf6776 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3db22e29d19eba5b2a85e78f4ae8330d3edf6776/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:4 | /// Ok(v) => println!("got = {:?}", v),
/// Err(_) => println!("the sender dropped"),
/// }
/// }
/// ```
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
#[allow(deprecated)]
let inner = Arc::new(Inner {
state: AtomicUsize::new(State::new().as_usize()),
value: UnsafeCell::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | ///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// println!("the receiver dropped");
/// }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | let inner = self.inner.as_ref().unwrap();
let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
coop.made_progress();
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.with_tx_task(|w| w.will... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// A [`Receiver`] is closed by either calling [`close`] explicitly or the
/// [`Receiver`] value is dropped.
///
/// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: Receiver
/// [`close`]: Receiver::close
///
/// # Examples
///
/// `... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | /// Err(TryRecvError::Closed) => {}
/// _ => unreachable!(),
/// }
/// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if sta... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
let ret = if let Some(inner) = self.as_ref().get_ref().inner.as_ref() {
ready!(inner.poll_recv(cx))?
} else {
panic!("called after... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else if state.is_closed() {
coop.made_progress();
Ready(Err(RecvError(())))
} else {
if state.is_rx_task_set() {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | coop.made_progress();
match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
}
} else {
Pending
}
} else {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | unsafe fn with_tx_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.tx_task.with(|ptr| {
let waker: *const Waker = (&*ptr).as_ptr();
f(&*waker)
})
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with_mut(|ptr| {
let ptr:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | unsafe impl<T: Send> Sync for Inner<T> {}
impl<T> Drop for Inner<T> {
fn drop(&mut self) {
let state = State(self.state.with_mut(|v| *v));
if state.is_rx_task_set() {
unsafe {
self.drop_rx_task();
}
}
if state.is_tx_task_set() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// TODO: This could be `Release`, followed by an `Acquire` fence *if*
// the `RX_TASK_SET` flag is set. However, `loom` does not support
// fences yet.
let v... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | }
fn unset_tx_task(cell: &AtomicUsize) -> State {
let val = cell.fetch_and(!TX_TASK_SET, AcqRel);
State(val & !TX_TASK_SET)
}
fn is_tx_task_set(self) -> bool {
self.0 & TX_TASK_SET == TX_TASK_SET
}
fn as_usize(self) -> usize {
self.0
}
fn load(cell: &Atomi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 9f63911adc5b809fd3df7cfbb736897a86895e0c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9f63911adc5b809fd3df7cfbb736897a86895e0c/tokio/src/sync/oneshot.rs | 761 | 791 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | ///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// println!("the receiver dropped");
/// }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | let inner = self.inner.as_ref().unwrap();
let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.with_tx_task(|w| w.will_wake(cx.waker())) };
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// If `true` is returned, a call to `send` will always result in an error.
///
/// [`Receiver`]: Receiver
/// [`close`]: Receiver::close
///
/// # Examples
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = onesh... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:12 | /// use tokio::sync::oneshot;
/// use tokio::sync::oneshot::error::TryRecvError;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, mut rx) = oneshot::channel();
///
/// match rx.try_recv() {
/// // The channel is currently empty
/// Err(TryRecvError::E... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | /// }
/// ```
pub fn try_recv(&mut self) -> Result<T, TryRecvError> {
let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if state.is_complete() {
match unsafe { inner.consume_value() } {
Som... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | ready!(inner.poll_recv(cx))?
} else {
panic!("called after complete");
};
self.inner = None;
Ready(Ok(ret))
}
}
impl<T> Inner<T> {
fn complete(&self) -> bool {
let prev = State::set_complete(&self.state);
if prev.is_closed() {
return fal... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | } else if state.is_closed() {
Ready(Err(RecvError(())))
} else {
if state.is_rx_task_set() {
let will_notify = unsafe { self.with_rx_task(|w| w.will_wake(cx.waker())) };
// Check if the task is still the same
if !will_notify {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | }
} else {
Pending
}
}
}
/// Called by `Receiver` to indicate that the value will never be received.
fn close(&self) {
let prev = State::set_closed(&self.state);
if prev.is_tx_task_set() && !prev.is_complete() {
unsafe {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | })
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with_mut(|ptr| {
let ptr: *mut Waker = (&mut *ptr).as_mut_ptr();
ptr.drop_in_place();
});
}
unsafe fn drop_tx_task(&self) {
self.tx_task.with_mut(|ptr| {
let ptr: *mut Waker = (&mut *ptr).as_m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | unsafe {
self.drop_rx_task();
}
}
if state.is_tx_task_set() {
unsafe {
self.drop_tx_task();
}
}
}
}
impl<T: fmt::Debug> fmt::Debug for Inner<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:19 | // fences yet.
let val = cell.fetch_or(VALUE_SENT, AcqRel);
State(val)
}
fn is_rx_task_set(self) -> bool {
self.0 & RX_TASK_SET == RX_TASK_SET
}
fn set_rx_task(cell: &AtomicUsize) -> State {
let val = cell.fetch_or(RX_TASK_SET, AcqRel);
State(val | RX_TASK_SET)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f39c15334e74b07a44efaa0f7201262e17e4f062 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f39c15334e74b07a44efaa0f7201262e17e4f062/tokio/src/sync/oneshot.rs | 721 | 780 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:1 | #![cfg_attr(not(feature = "sync"), allow(dead_code, unreachable_pub))]
//! A channel for sending a single message between asynchronous tasks.
use crate::loom::cell::UnsafeCell;
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use std::fmt;
use std::future::Future;
use std::mem::MaybeUninit;
us... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/sync/oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:1 | #![cfg_attr(not(feature = "sync"), allow(dead_code, unreachable_pub))]
//! A channel for sending a single message between asynchronous tasks.
use crate::loom::cell::CausalCell;
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use std::fmt;
use std::future::Future;
use std::mem::MaybeUninit;
us... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/sync/oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:2 | /// Error returned by the `try_recv` function on `Receiver`.
#[derive(Debug, Eq, PartialEq)]
pub enum TryRecvError {
/// The send half of the channel has not yet sent a value.
Empty,
/// The send half of the channel was dropped without sending a value.
Closed,
}
// ====... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/sync/oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:3 | /// The value. This is set by `Sender` and read by `Receiver`. The state of
/// the cell is tracked by `state`.
value: CausalCell<Option<T>>,
/// The task to notify when the receiver drops without consuming the value.
tx_task: CausalCell<MaybeUninit<Waker>>,
/// The task to notify when the value i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/sync/oneshot.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:4 | /// Ok(v) => println!("got = {:?}", v),
/// Err(_) => println!("the sender dropped"),
/// }
/// }
/// ```
pub fn channel<T>() -> (Sender<T>, Receiver<T>) {
#[allow(deprecated)]
let inner = Arc::new(Inner {
state: AtomicUsize::new(State::new().as_usize()),
value: CausalCell::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/sync/oneshot.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | })
}
unsafe fn drop_rx_task(&self) {
self.rx_task.with_mut(|ptr| {
let ptr: *mut Waker = (&mut *ptr).as_mut_ptr();
ptr.drop_in_place();
});
}
unsafe fn drop_tx_task(&self) {
self.tx_task.with_mut(|ptr| {
let ptr: *mut Waker = (&mut *ptr).as_m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:5 | ///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// tokio::spawn(async move {
/// if let Err(_) = tx.send(3) {
/// println!("the receiver dropped");
/// }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.with_tx_task(|w| w.will_wake(cx.waker())) };
if !will_notify {
state = State::u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// [`close`]: Receiver::close
///
/// # Examples
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// assert!(!tx.is_closed());
///
/// drop(rx);
///
/// assert!(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if state.is_complete() {
match unsafe { inner.consume_value() } {
Some(value) => Ok(value),
None => Err(TryRecvError::Closed),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | };
self.inner = None;
Ready(Ok(ret))
}
}
impl<T> Inner<T> {
fn complete(&self) -> bool {
let prev = State::set_complete(&self.state);
if prev.is_closed() {
return false;
}
if prev.is_rx_task_set() {
// TODO: Consume waker?
u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | // Check if the task is still the same
if !will_notify {
// Unset the task
state = State::unset_rx_task(&self.state);
if state.is_complete() {
// Set the flag again so that the waker is released in drop
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | /// Called by `Receiver` to indicate that the value will never be received.
fn close(&self) {
let prev = State::set_closed(&self.state);
if prev.is_tx_task_set() && !prev.is_complete() {
unsafe {
self.with_tx_task(Waker::wake_by_ref);
}
}
}
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:17 | ptr.drop_in_place();
});
}
unsafe fn drop_tx_task(&self) {
self.tx_task.with_mut(|ptr| {
let ptr: *mut Waker = (&mut *ptr).as_mut_ptr();
ptr.drop_in_place();
});
}
unsafe fn set_rx_task(&self, cx: &mut Context<'_>) {
self.rx_task.with_mut(|ptr| {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 641 | 700 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | unsafe {
self.drop_tx_task();
}
}
}
}
impl<T: fmt::Debug> fmt::Debug for Inner<T> {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
use std::sync::atomic::Ordering::Relaxed;
fmt.debug_struct("Inner")
.field("state", &State::load(&sel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 0d49e112b2a7fc3cc268c1c140d0130d865af760 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d49e112b2a7fc3cc268c1c140d0130d865af760/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:1 | #![cfg_attr(not(feature = "sync"), allow(dead_code, unreachable_pub))]
//! A channel for sending a single message between asynchronous tasks.
use crate::loom::cell::CausalCell;
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use std::fmt;
use std::future::Future;
use std::mem::MaybeUninit;
us... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f9ddb93604a830d106475bd4c4cae436fafcc0da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/sync/oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:2 | /// Error returned by the `try_recv` function on `Receiver`.
#[derive(Debug, PartialEq)]
pub enum TryRecvError {
/// The send half of the channel has not yet sent a value.
Empty,
/// The send half of the channel was dropped without sending a value.
Closed,
}
// ===== im... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | f9ddb93604a830d106475bd4c4cae436fafcc0da | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/sync/oneshot.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:6 | let mut state = State::load(&inner.state, Acquire);
if state.is_closed() {
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.with_tx_task(|w| w.will_wake(cx.waker())) };
if !will_notify {
state = State::u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/oneshot.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | /// [`close`]: Receiver::close
///
/// # Examples
///
/// ```
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel();
///
/// assert!(!tx.is_closed());
///
/// drop(rx);
///
/// assert!(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | // Check if the task is still the same
if !will_notify {
// Unset the task
state = State::unset_rx_task(&self.state);
if state.is_complete() {
// Set the flag again so that the waker is released in drop
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | /// Called by `Receiver` to indicate that the value will never be received.
fn close(&self) {
let prev = State::set_closed(&self.state);
if prev.is_tx_task_set() && !prev.is_complete() {
unsafe {
self.with_tx_task(Waker::wake_by_ref);
}
}
}
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a5e774bb38f3d0c6dc0e32d3b083021f5bc388fd/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:1 | #![cfg_attr(not(feature = "sync"), allow(dead_code, unreachable_pub))]
//! A channel for sending a single message between asynchronous tasks.
use crate::loom::cell::CausalCell;
use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::Arc;
use std::fmt;
use std::future::Future;
use std::mem::MaybeUninit;
us... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | dcfa895b512e3ed522b81b18baf3e33fd78a600c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dcfa895b512e3ed522b81b18baf3e33fd78a600c/tokio/src/sync/oneshot.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:2 | /// Error returned by the `try_recv` function on `Receiver`.
#[derive(Debug)]
pub enum TryRecvError {
/// The send half of the channel has not yet sent a value.
Empty,
/// The send half of the channel was dropped without sending a value.
Closed,
}
// ===== impl RecvErro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | dcfa895b512e3ed522b81b18baf3e33fd78a600c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dcfa895b512e3ed522b81b18baf3e33fd78a600c/tokio/src/sync/oneshot.rs | 41 | 100 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.