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:34 | state | VALUE_SENT,
Ordering::AcqRel,
Ordering::Acquire,
) {
Ok(_) => break,
Err(actual) => state = actual,
}
}
State(state)
}
fn is_rx_task_set(self) -> bool {
self.0 & RX_TASK_SET == RX_TASK_SET
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/sync/oneshot.rs | 1,321 | 1,380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:35 | 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: &AtomicUsize,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 131e7b4e49c8849298ba54b4e0c99f4b81d869e3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/sync/oneshot.rs | 1,361 | 1,390 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | #[derive(Debug)]
pub struct Receiver<T> {
inner: Option<Arc<Inner<T>>>,
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_poll... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | state: AtomicUsize::new(State::new().as_usize()),
value: UnsafeCell::new(None),
tx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
rx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
});
let tx = Sender {
inner: Some(inner.clone()),
#[cfg(all(tokio_unstable, featu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 7b555185ff9186f618b198126ee853980b187698 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b555185ff9186f618b198126ee853980b187698/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:12 | ///
/// The function returns separate "send" and "receive" handles. The `Sender`
/// handle is used by the producer to send the value. The `Receiver` handle is
/// used by the consumer to receive the value.
///
/// Each handle can be used on separate tasks.
///
/// # Examples
///
/// ```
/// use tokio::sync::oneshot;
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | loc.col = location.column(),
);
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
tx_dropped = false,
tx_dropped.op = "override",
)
});
resource_span.in_scope(|| {
tracing::tra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | value: UnsafeCell::new(None),
tx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
rx_task: Task(UnsafeCell::new(MaybeUninit::uninit())),
});
let tx = Sender {
inner: Some(inner.clone()),
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: resource_span.clo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | // That bit is only set by the sender later on in this method, and
// calling this method consumes `self`. Therefore, if it was possible to
// call this method, we know that the `VALUE_SENT` bit is unset, and
// the receiver is not currently accessing the `UnsafeCell`.
*p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | ///
/// tokio::spawn(async move {
/// tokio::select! {
/// _ = tx.closed() => {
/// // The receiver dropped, no need to do any further work
/// }
/// value = compute() => {
/// // The send can fail if the channel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | ///
/// [`Receiver`]: struct@crate::sync::oneshot::Receiver
/// [`close`]: fn@crate::sync::oneshot::Receiver::close
///
/// # Return value
///
/// This function returns:
///
/// * `Poll::Pending` if the channel is still open.
/// * `Poll::Ready(())` if the channel is closed.
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | if state.is_closed() {
coop.made_progress();
return Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.tx_task.will_wake(cx) };
if !will_notify {
state = State::unset_tx_task(&inner.state);
if state... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:22 | }
impl<T> Drop for Sender<T> {
fn drop(&mut self) {
if let Some(inner) = self.inner.as_ref() {
inner.complete();
#[cfg(all(tokio_unstable, feature = "tracing"))]
self.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:25 | /// #[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 | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | let result = if let Some(inner) = self.inner.as_ref() {
let state = State::load(&inner.state, Acquire);
if state.is_complete() {
// SAFETY: If `state.is_complete()` returns true, then the
// `VALUE_SENT` bit has been set and the sender side of the
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | ///
/// This function panics if called within an asynchronous execution
/// context.
///
/// # Examples
///
/// ```
/// use std::thread;
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | )
});
}
}
}
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.
#[cfg(all(tokio_unstable, feature = "tracing"))... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | return false;
}
if prev.is_rx_task_set() {
// TODO: Consume waker?
unsafe {
self.rx_task.with_task(Waker::wake_by_ref);
}
}
true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
ready!(crate... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:30 | State::set_rx_task(&self.state);
coop.made_progress();
// SAFETY: If `state.is_complete()` returns true, then the
// `VALUE_SENT` bit has been set and the sender side of the
// channel will no longer attempt to access the i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:31 | }
/// 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.tx_task.with_task(Waker::wake_by_ref);
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:32 | 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: &mut fmt::Formatter<'_>) -> fmt::Result {
use std::sync::ato... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:33 | ///
/// # Safety
///
/// If this bit is not set, the `tx_task` field may be uninitialized.
const TX_TASK_SET: usize = 0b01000;
impl State {
fn new() -> State {
State(0)
}
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> Stat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,281 | 1,340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:34 | Ordering::AcqRel,
Ordering::Acquire,
) {
Ok(_) => break,
Err(actual) => state = actual,
}
}
State(state)
}
fn is_rx_task_set(self) -> bool {
self.0 & RX_TASK_SET == RX_TASK_SET
}
fn set_rx_task(cell: &Atomi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/sync/oneshot.rs | 1,321 | 1,380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | ///
/// tokio::spawn(async move {
/// tokio::select! {
/// _ = tx.closed() => {
/// // The receiver dropped, no need to do any further work
/// }
/// value = compute() => {
/// // The send can fail if the channel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 78bf8a9e5e72430274467cebce4cc37096508c18 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78bf8a9e5e72430274467cebce4cc37096508c18/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | ///
/// [`Receiver`]: struct@crate::sync::oneshot::Receiver
/// [`close`]: fn@crate::sync::oneshot::Receiver::close
///
/// # Return value
///
/// This function returns:
///
/// * `Poll::Pending` if the channel is still open.
/// * `Poll::Ready(())` if the channel is closed.
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | if state.is_closed() {
coop.made_progress();
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.tx_task.will_wake(cx) };
if !will_notify {
state = State::unset_tx_task(&inner.state);
if... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 7a99f87df203d589d9a8ad042a64b105a954f9fb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/oneshot.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | ///
/// [`Receiver`]: struct@crate::sync::oneshot::Receiver
/// [`close`]: fn@crate::sync::oneshot::Receiver::close
///
/// # Return value
///
/// This function returns:
///
/// * `Poll::Pending` if the channel is still open.
/// * `Poll::Ready(())` if the channel is closed.
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | coop.made_progress();
return Poll::Ready(());
}
if state.is_tx_task_set() {
let will_notify = unsafe { inner.tx_task.will_wake(cx) };
if !will_notify {
state = State::unset_tx_task(&inner.state);
if state.is_closed() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:22 | impl<T> Drop for Sender<T> {
fn drop(&mut self) {
if let Some(inner) = self.inner.as_ref() {
inner.complete();
#[cfg(all(tokio_unstable, feature = "tracing"))]
self.resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:25 | /// let (tx, mut rx) = oneshot::channel();
///
/// match rx.try_recv() {
/// // The channel is currently empty
/// Err(TryRecvError::Empty) => {}
/// _ => unreachable!(),
/// }
///
/// // Send a value
/// tx.send("hello").unwrap();
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | if state.is_complete() {
// SAFETY: If `state.is_complete()` returns true, then the
// `VALUE_SENT` bit has been set and the sender side of the
// channel will no longer attempt to access the inner
// `UnsafeCell`. Therefore, it is now safe for us to acces... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | /// context.
///
/// # Examples
///
/// ```
/// use std::thread;
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
/// let sync_code = thread::spawn(move || {
/// assert_eq!(Ok(1... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | }
}
}
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.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | if prev.is_rx_task_set() {
// TODO: Consume waker?
unsafe {
self.rx_task.with_task(Waker::wake_by_ref);
}
}
true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
// Keep track of task budget
let coop... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:30 | // SAFETY: If `state.is_complete()` returns true, then the
// `VALUE_SENT` bit has been set and the sender side of the
// channel will no longer attempt to access the inner
// `UnsafeCell`. Therefore, it is now safe for us to access the
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:31 | fn close(&self) {
let prev = State::set_closed(&self.state);
if prev.is_tx_task_set() && !prev.is_complete() {
unsafe {
self.tx_task.with_task(Waker::wake_by_ref);
}
}
}
/// Consumes the value. This function does not check `state`.
///
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:32 | 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_struct("Inner")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | c89406965ffb4a64936d781c556a2c48855dfbdb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c89406965ffb4a64936d781c556a2c48855dfbdb/tokio/src/sync/oneshot.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:8 | /// }
/// }
/// ```
///
/// To use a `Receiver` in a `tokio::select!` loop, add `&mut` in front of the
/// channel.
///
/// ```
/// use tokio::sync::oneshot;
/// use tokio::time::{interval, sleep, Duration};
///
/// #[tokio::main]
/// # async fn _doc() {}
/// # #[tokio::main(flavor = "current_thread", start_paused ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | resource_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_poll_span: tracing::Span,
}
pub mod error {
//! Oneshot error types.
use std::fmt;
/// Error returned by the `Future` impl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:10 | impl fmt::Display for TryRecvError {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
TryRecvError::Empty => write!(fmt, "channel empty"),
TryRecvError::Closed => write!(fmt, "channel closed"),
}
}
}
impl std::erro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:11 | impl Task {
unsafe fn will_wake(&self, cx: &mut Context<'_>) -> bool {
self.with_task(|w| w.will_wake(cx.waker()))
}
unsafe fn with_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.0.with(|ptr| {
let waker: *const Waker = (*ptr).as_ptr();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:12 | ///
/// Each handle can be used on separate tasks.
///
/// # Examples
///
/// ```
/// 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 dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | tracing::trace!(
target: "runtime::resource::state_update",
tx_dropped = false,
tx_dropped.op = "override",
)
});
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
rx_dropped = fals... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | let tx = Sender {
inner: Some(inner.clone()),
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: resource_span.clone(),
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let async_op_span = resource_span
.in_scope(|| tracing::trace_span!("runtime.resource.asyn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | /// the corresponding receiver has already been deallocated. Note that a
/// return value of `Err` means that the data will never be received, but
/// a return value of `Ok` does *not* mean that the data will be received.
/// It is possible for the corresponding receiver to hang up immediately
/// after... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | *ptr = Some(t);
});
if !inner.complete() {
unsafe {
// SAFETY: The receiver will not access the `UnsafeCell` unless
// the channel has been marked as "complete". Calling
// `complete()` will return true if this bit is set, and false
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | /// // The receiver dropped, no need to do any further work
/// }
/// value = compute() => {
/// // The send can fail if the channel was closed at the exact same
/// // time as when compute() finished, so just ignore the failure.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | /// # Return value
///
/// 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;
///
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | if state.is_tx_task_set() {
let will_notify = unsafe { inner.tx_task.will_wake(cx) };
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
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:25 | /// Err(TryRecvError::Empty) => {}
/// _ => unreachable!(),
/// }
///
/// // Send a value
/// tx.send("hello").unwrap();
///
/// match rx.try_recv() {
/// Ok(value) => assert_eq!(value, "hello"),
/// _ => unreachable!(),
/// }
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | // channel will no longer attempt to access the inner
// `UnsafeCell`. Therefore, it is now safe for us to access the
// cell.
match unsafe { inner.consume_value() } {
Some(value) => {
#[cfg(all(tokio_unstable, feature = "tracin... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | /// ```
/// use std::thread;
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
/// let sync_code = thread::spawn(move || {
/// assert_eq!(Ok(10), rx.blocking_recv());
/// });
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | 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.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = self.resour... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | self.rx_task.with_task(Waker::wake_by_ref);
}
}
true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
// Keep track of task budget
let coop = ready!(crate::runtime::coop::poll_proceed(cx));
// Load the state
let mut state ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:30 | // cell.
return match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
};
} else {
unsafe { self.rx_task.drop_task() };... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:31 | unsafe {
self.tx_task.with_task(Waker::wake_by_ref);
}
}
}
/// Consumes the value. This function does not check `state`.
///
/// # Safety
///
/// Calling this method concurrently on multiple threads will result in a
/// data race. The `VALUE_SENT` state b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:32 | }
}
}
}
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(&self.state, Relaxed))
.finish()
}
}
/// Indi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:33 | fn new() -> State {
State(0)
}
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// This method is a compare-and-swap loop rather than a fetch-or like
// other `set_$WHATEVER` methods on `State`. This is be... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,281 | 1,340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:34 | State(state)
}
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)
}
fn unset_rx_task(cell: &AtomicUsize) -> State {
let val... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,321 | 1,380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:35 | }
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 fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("State")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | d19f2f2d395a4d6befb5f66ff87a19172aede2ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d19f2f2d395a4d6befb5f66ff87a19172aede2ee/tokio/src/sync/oneshot.rs | 1,361 | 1,382 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | // channel will no longer attempt to access the inner
// `UnsafeCell`. Therefore, it is now safe for us to access the
// cell.
match unsafe { inner.consume_value() } {
Some(value) => {
#[cfg(all(tokio_unstable, feature = "tracin... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | /// ```
/// use std::thread;
/// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
/// let sync_code = thread::spawn(move || {
/// assert_eq!(Ok(10), rx.blocking_recv());
/// });
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | 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.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = self.resource_span.clone().entered();
#[... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | }
}
true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
// Keep track of task budget
let coop = ready!(crate::runtime::coop::poll_proceed(cx));
// Load the state
let mut state = State::load(&self.state, Acquire);
if state.i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:30 | return match unsafe { self.consume_value() } {
Some(value) => Ready(Ok(value)),
None => Ready(Err(RecvError(()))),
};
} else {
unsafe { self.rx_task.drop_task() };
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:31 | self.tx_task.with_task(Waker::wake_by_ref);
}
}
}
/// Consumes the value. This function does not check `state`.
///
/// # Safety
///
/// Calling this method concurrently on multiple threads will result in a
/// data race. The `VALUE_SENT` state bit is used to ensure that... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:32 | }
}
}
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(&self.state, Relaxed))
.finish()
}
}
/// Indicates that... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:33 | State(0)
}
fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// This method is a compare-and-swap loop rather than a fetch-or like
// other `set_$WHATEVER` methods on `State`. This is because we must
// che... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,281 | 1,340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:34 | }
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)
}
fn unset_rx_task(cell: &AtomicUsize) -> State {
let val = cell.fetch_and... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,321 | 1,380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:35 | 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 fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("State")
.field... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cbbcc9ad57ccf413f58d9dcd66d2ea7e68a0766/tokio/src/sync/oneshot.rs | 1,361 | 1,381 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:8 | /// }
/// }
/// ```
///
/// To use a `Receiver` in a `tokio::select!` loop, add `&mut` in front of the
/// channel.
///
/// ```
/// use tokio::sync::oneshot;
/// use tokio::time::{interval, sleep, Duration};
///
/// #[tokio::main]
/// # async fn _doc() {}
/// # #[tokio::main(flavor = "current_thread", start_paused ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:9 | resource_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_span: tracing::Span,
#[cfg(all(tokio_unstable, feature = "tracing"))]
async_op_poll_span: tracing::Span,
}
pub mod error {
//! Oneshot error types.
use std::fmt;
/// Error returned by the `Future` impl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:10 | match self {
TryRecvError::Empty => write!(fmt, "channel empty"),
TryRecvError::Closed => write!(fmt, "channel closed"),
}
}
}
impl std::error::Error for TryRecvError {}
}
use self::error::*;
struct Inner<T> {
/// Manages the state of the inner cell.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:11 | unsafe fn will_wake(&self, cx: &mut Context<'_>) -> bool {
self.with_task(|w| w.will_wake(cx.waker()))
}
unsafe fn with_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.0.with(|ptr| {
let waker: *const Waker = (*ptr).as_ptr();
f(&*waker)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:12 | ///
/// # Examples
///
/// ```
/// 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");
/// }
/// });
///
/// matc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:13 | tx_dropped = false,
tx_dropped.op = "override",
)
});
resource_span.in_scope(|| {
tracing::trace!(
target: "runtime::resource::state_update",
rx_dropped = false,
rx_dropped.op = "override",
)
});
resour... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:14 | inner: Some(inner.clone()),
#[cfg(all(tokio_unstable, feature = "tracing"))]
resource_span: resource_span.clone(),
};
#[cfg(all(tokio_unstable, feature = "tracing"))]
let async_op_span = resource_span
.in_scope(|| tracing::trace_span!("runtime.resource.async_op", source = "Receiver:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:15 | /// a return value of `Ok` does *not* mean that the data will be received.
/// It is possible for the corresponding receiver to hang up immediately
/// after this function returns `Ok`.
///
/// # Examples
///
/// Send a value to another task
///
/// ```
/// use tokio::sync::oneshot;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:16 | if !inner.complete() {
unsafe {
// SAFETY: The receiver will not access the `UnsafeCell` unless
// the channel has been marked as "complete". Calling
// `complete()` will return true if this bit is set, and false
// if it is not set. Thus, if `... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 601 | 660 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:18 | /// value = compute() => {
/// // The send can fail if the channel was closed at the exact same
/// // time as when compute() finished, so just ignore the failure.
/// let _ = tx.send(value);
/// }
/// }
/// });
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 681 | 740 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | /// 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 | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:21 | 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 | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 801 | 860 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:25 | /// }
///
/// // Send a value
/// tx.send("hello").unwrap();
///
/// match rx.try_recv() {
/// Ok(value) => assert_eq!(value, "hello"),
/// _ => unreachable!(),
/// }
/// }
/// ```
///
/// `try_recv` when the sender dropped before sendi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | // cell.
match unsafe { inner.consume_value() } {
Some(value) => {
#[cfg(all(tokio_unstable, feature = "tracing"))]
self.resource_span.in_scope(|| {
tracing::trace!(
target: "runti... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | /// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
/// let sync_code = thread::spawn(move || {
/// assert_eq!(Ok(10), rx.blocking_recv());
/// });
///
/// let _ = tx.send(10);
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = self.resource_span.clone().entered();
#[cfg(all(tokio_unstable, feature = "tracin... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
// Keep track of task budget
let coop = ready!(crate::runtime::coop::poll_proceed(cx));
// Load the state
let mut state = State::load(&self.state, Acquire);
if state.is_complete() {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:30 | None => Ready(Err(RecvError(()))),
};
} else {
unsafe { self.rx_task.drop_task() };
}
}
}
if !state.is_rx_task_set() {
// Attempt to set the task
unsafe {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:31 | }
}
/// Consumes the value. This function does not check `state`.
///
/// # Safety
///
/// Calling this method concurrently on multiple threads will result in a
/// data race. The `VALUE_SENT` state bit is used to ensure that only the
/// sender *or* the receiver will call this method a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:32 | }
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(&self.state, Relaxed))
.finish()
}
}
/// Indicates that a waker... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:33 | fn is_complete(self) -> bool {
self.0 & VALUE_SENT == VALUE_SENT
}
fn set_complete(cell: &AtomicUsize) -> State {
// This method is a compare-and-swap loop rather than a fetch-or like
// other `set_$WHATEVER` methods on `State`. This is because we must
// check if the state has ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,281 | 1,340 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:34 | 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)
}
fn unset_rx_task(cell: &AtomicUsize) -> State {
let val = cell.fetch_and(!RX_TA... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,321 | 1,379 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:35 | 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 fmt::Formatter<'_>) -> fmt::Result {
fmt.debug_struct("State")
.field("is_complete", &self.is_complete())
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/sync/oneshot.rs | 1,361 | 1,379 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:10 | match self {
TryRecvError::Empty => write!(fmt, "channel empty"),
TryRecvError::Closed => write!(fmt, "channel closed"),
}
}
}
impl std::error::Error for TryRecvError {}
}
use self::error::*;
struct Inner<T> {
/// Manages the state of the inner cell.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a051ed726f3b99b077e8c9ef8ef1df2ab2943213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/sync/oneshot.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:11 | unsafe fn will_wake(&self, cx: &mut Context<'_>) -> bool {
self.with_task(|w| w.will_wake(cx.waker()))
}
unsafe fn with_task<F, R>(&self, f: F) -> R
where
F: FnOnce(&Waker) -> R,
{
self.0.with(|ptr| {
let waker: *const Waker = (&*ptr).as_ptr();
f(&*waker)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | a051ed726f3b99b077e8c9ef8ef1df2ab2943213 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/sync/oneshot.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:20 | /// 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 | 4daeea8cad1ce8e67946bc0e17d499ab304b5ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/oneshot.rs | 761 | 820 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// If `inner` is `None`, then `poll()` has already completed.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = self.resource_span.clone().entered();
#[cfg(all(tokio_unstable, feature = "tracin... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 4daeea8cad1ce8e67946bc0e17d499ab304b5ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:29 | true
}
fn poll_recv(&self, cx: &mut Context<'_>) -> Poll<Result<T, RecvError>> {
// Keep track of task budget
let coop = ready!(crate::coop::poll_proceed(cx));
// Load the state
let mut state = State::load(&self.state, Acquire);
if state.is_complete() {
coo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 4daeea8cad1ce8e67946bc0e17d499ab304b5ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4daeea8cad1ce8e67946bc0e17d499ab304b5ca2/tokio/src/sync/oneshot.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:26 | // cell.
match unsafe { inner.consume_value() } {
Some(value) => {
#[cfg(all(tokio_unstable, feature = "tracing"))]
self.resource_span.in_scope(|| {
tracing::trace!(
target: "runti... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 34b8ebbe662cd8c818bc017e81a717a465ab1f01 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/34b8ebbe662cd8c818bc017e81a717a465ab1f01/tokio/src/sync/oneshot.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:27 | /// use tokio::sync::oneshot;
///
/// #[tokio::main]
/// async fn main() {
/// let (tx, rx) = oneshot::channel::<u8>();
///
/// let sync_code = thread::spawn(move || {
/// assert_eq!(Ok(10), rx.blocking_recv());
/// });
///
/// let _ = tx.send(10);
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 34b8ebbe662cd8c818bc017e81a717a465ab1f01 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/34b8ebbe662cd8c818bc017e81a717a465ab1f01/tokio/src/sync/oneshot.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/sync/oneshot.rs:28 | // If `inner` is `None`, then `poll()` has already completed.
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _res_span = self.resource_span.clone().entered();
#[cfg(all(tokio_unstable, feature = "tracing"))]
let _ao_span = self.async_op_span.clone().entered();
#[cfg(all(tok... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/sync/oneshot.rs | MIT | 34b8ebbe662cd8c818bc017e81a717a465ab1f01 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/34b8ebbe662cd8c818bc017e81a717a465ab1f01/tokio/src/sync/oneshot.rs | 1,081 | 1,140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.