id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::runtime::park::CachedParkThread; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::{bounded, list, unbounded}; use crate::sync::notify::Notify; us...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn add_permit(&self); fn close(&self); fn is_closed(&self) -> bool; } pub(super) struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped. notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to c...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
.finish() } } /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<T> { fn fmt(&self, fmt: &mut fmt::Fo...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
(Tx::new(chan.clone()), Rx::new(chan)) } // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn downgrade(&self) -> Arc<Chan<T, S>> { self.inner.clone() } // Returns the upgraded channel or None if the upgrade f...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
self.inner.send(value); } /// Wake the receive half pub(crate) fn wake_rx(&self) { self.inner.rx_waker.wake(); } /// Returns `true` if senders belong to the same channel. pub(crate) fn same_channel(&self, other: &Self) -> bool { Arc::ptr_eq(&self.inner, &other.inner) } } i...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} } } impl<T, S> Drop for Tx<T, S> { fn drop(&mut self) { if self.inner.tx_count.fetch_sub(1, AcqRel) != 1 { return; } // Close the list, which sends a `Close` message self.inner.tx.close(); // Notify the receiver self.wake_rx(); } } // ===== i...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
/// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; ready!(crate::trace::trace_leaf(cx)); // Keep track of task budget let coop = ready!(crate::runtime::coop::poll_proceed(cx)); self.inner.rx_fields...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
// // This is not a spurious wakeup to `poll_recv` since we just got a // Busy from `try_pop`, which only happens if there are messages in // the queue. self.inner.rx_waker.wake(); // Park the thread until the problematic send has completed. let m...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
// Push the value self.tx.push(value); // Notify the rx task self.rx_waker.wake(); } } impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and being // inside its own Drop mean...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
361
420
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:11
} } // ===== impl Semaphore for AtomicUsize ===== impl Semaphore for unbounded::Semaphore { fn add_permit(&self) { let prev = self.0.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
7a99f87df203d589d9a8ad042a64b105a954f9fb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a99f87df203d589d9a8ad042a64b105a954f9fb/tokio/src/sync/mpsc/chan.rs
401
427
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} } } impl<T, S> Drop for Tx<T, S> { fn drop(&mut self) { if self.inner.tx_count.fetch_sub(1, AcqRel) != 1 { return; } // Close the list, which sends a `Close` message self.inner.tx.close(); // Notify the receiver self.wake_rx(); } } // ===== i...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
/// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; // Keep track of task budget let coop = ready!(crate::runtime::coop::poll_proceed(cx)); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
// second time here. try_recv!(); if rx_fields.rx_closed && self.inner.semaphore.is_idle() { coop.made_progress(); Ready(None) } else { Pending } }) } /// Try to receive the next value. pub(crate) fn tr...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
// Busy from `try_pop`, which only happens if there are messages in // the queue. self.inner.rx_waker.wake(); // Park the thread until the problematic send has completed. let mut park = CachedParkThread::new(); let waker = park.waker().unwrap(); l...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
// Notify the rx task self.rx_waker.wake(); } } impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and being // inside its own Drop means we're the last ones to touch it. self.rx_field...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
361
420
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:11
// ===== impl Semaphore for AtomicUsize ===== impl Semaphore for unbounded::Semaphore { fn add_permit(&self) { let prev = self.0.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { sel...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
467adec4e16bdf1b5461e77d87d1d56b4a29f001
github
async-runtime
https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/sync/mpsc/chan.rs
401
425
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::park::thread::CachedParkThread; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::{bounded, list, unbounded}; use crate::sync::notify::Notify; use...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a051ed726f3b99b077e8c9ef8ef1df2ab2943213
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} } } impl<T, S> Drop for Tx<T, S> { fn drop(&mut self) { if self.inner.tx_count.fetch_sub(1, AcqRel) != 1 { return; } // Close the list, which sends a `Close` message self.inner.tx.close(); // Notify the receiver self.wake_rx(); } } // ===== i...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
15b362d2ddfc9eb51029b74d69dd74216a7a5b94
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15b362d2ddfc9eb51029b74d69dd74216a7a5b94/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
/// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; // Keep track of task budget let coop = ready!(crate::coop::poll_proceed(cx)); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
15b362d2ddfc9eb51029b74d69dd74216a7a5b94
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15b362d2ddfc9eb51029b74d69dd74216a7a5b94/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::park::thread::CachedParkThread; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::notify::Notify; use std::fmt; use std::pr...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn add_permit(&self); fn close(&self); fn is_closed(&self) -> bool; } pub(super) struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped. notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to c...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
.field("rx_fields", &"...") .finish() } } /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
inner: self.inner.clone(), } } } impl<T, S> Drop for Tx<T, S> { fn drop(&mut self) { if self.inner.tx_count.fetch_sub(1, AcqRel) != 1 { return; } // Close the list, which sends a `Close` message self.inner.tx.close(); // Notify the receiver ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
/// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; // Keep track of task budget let coop = ready!(crate::coop::poll_proceed(cx)); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
// and registering the task, so we have to check the channel a // second time here. try_recv!(); if rx_fields.rx_closed && self.inner.semaphore.is_idle() { coop.made_progress(); Ready(None) } else { Pending } ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
// This is not a spurious wakeup to `poll_recv` since we just got a // Busy from `try_pop`, which only happens if there are messages in // the queue. self.inner.rx_waker.wake(); // Park the thread until the problematic send has completed. let mut park = Cache...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
self.tx.push(value); // Notify the rx task self.rx_waker.wake(); } } impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and being // inside its own Drop means we're the last ones to t...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
361
420
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:11
} // ===== impl Semaphore for AtomicUsize ===== impl Semaphore for AtomicUsize { fn add_permit(&self) { let prev = self.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { self.load(A...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/sync/mpsc/chan.rs
401
426
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::park::thread::CachedParkThread; use crate::park::Park; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::notify::Notify; us...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn is_idle(&self) -> bool; fn add_permit(&self); fn close(&self); fn is_closed(&self) -> bool; } pub(super) struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped. notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
.field("tx_count", &self.tx_count) .field("rx_fields", &"...") .finish() } } /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_cl...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
}); (Tx::new(chan.clone()), Rx::new(chan)) } // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn downgrade(&self) -> Arc<Chan<T, S>> { self.inner.clone() } // Returns the upgraded channel or None if the ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
Tx { inner: self.inner.clone(), } } } impl<T, S> Drop for Tx<T, S> { fn drop(&mut self) { if self.inner.tx_count.fetch_sub(1, AcqRel) != 1 { return; } // Close the list, which sends a `Close` message self.inner.tx.close(); // Notify the ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
} /// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; // Keep track of task budget let coop = ready!(crate::coop::poll_proceed(cx)); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fi...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
// It is possible that a value was pushed between attempting to read // and registering the task, so we have to check the channel a // second time here. try_recv!(); if rx_fields.rx_closed && self.inner.semaphore.is_idle() { coop.made_progress(); ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
// // This is not a spurious wakeup to `poll_recv` since we just got a // Busy from `try_pop`, which only happens if there are messages in // the queue. self.inner.rx_waker.wake(); // Park the thread until the problematic send has completed. let m...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
// Push the value self.tx.push(value); // Notify the rx task self.rx_waker.wake(); } } impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and being // inside its own Drop mean...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
361
420
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:11
} } // ===== impl Semaphore for AtomicUsize ===== impl Semaphore for AtomicUsize { fn add_permit(&self) { let prev = self.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { self.load...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1d75b57ad0f134f71a32cc42d1bd3e7a3e21a7f7/tokio/src/sync/mpsc/chan.rs
401
427
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::park::thread::CachedParkThread; use crate::park::Park; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::notify::Notify; us...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn add_permit(&self); fn close(&self); fn is_closed(&self) -> bool; } struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped. notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to channel's ca...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
.field("rx_fields", &"...") .finish() } } /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
(Tx::new(chan.clone()), Rx::new(chan)) } // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
let notified = self.inner.notify_rx_closed.notified(); if self.inner.semaphore.is_closed() { return; } notified.await; } } impl<T, S> Clone for Tx<T, S> { fn clone(&self) -> Tx<T, S> { // Using a Relaxed ordering here is sufficient as the caller holds a // s...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} pub(crate) fn close(&mut self) { self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; if rx_fields.rx_closed { return; } rx_fields.rx_closed = true; }); self.inner.semaphore.close...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
// which ensures that if dropping the tx handle is // visible, then all messages sent are also visible. assert!(self.inner.semaphore.is_idle()); coop.made_progress(); return Ready(None); ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
self.inner.semaphore.add_permit(); return Ok(value); } TryPopResult::Closed => return Err(TryRecvError::Disconnected), TryPopResult::Empty => return Err(TryRecvError::Empty), TryPopResult::Busy =>...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) = rx_fields.list.pop(&self.inner.tx) { self.inner.semaphore.add_permit(); } }) } } // ===== impl Chan ===== impl<T, S> Chan<T, S> { ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
impl Semaphore for (crate::sync::batch_semaphore::Semaphore, usize) { fn add_permit(&self) { self.0.release(1) } fn is_idle(&self) -> bool { self.0.available_permits() == self.1 } fn close(&self) { self.0.close(); } fn is_closed(&self) -> bool { self.0.is_c...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
f26ce08f37d8c8426736412f7aca51f4f39d43d3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f26ce08f37d8c8426736412f7aca51f4f39d43d3/tokio/src/sync/mpsc/chan.rs
361
405
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) = rx_fields.list.pop(&self.inner.tx) { self.inner.semaphore.add_permit(); } }) } } // ===== impl Chan ===== impl<T, S> Chan<T, S> { ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::park::thread::CachedParkThread; use crate::park::Park; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::notify::Notify; us...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn add_permit(&self); fn close(&self); fn is_closed(&self) -> bool; } struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to channel's cap...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ddd33f2b05dacd81c5fcd3170c1c9e1b2abad0f5/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::sync::mpsc::list; use crate::sync::notify::Notify; use std::fmt; use std::process; use std::sync::atomic::Ordering::{AcqRel, Relaxed}; use std::task::Poll::{Pendin...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn close(&self); fn is_closed(&self) -> bool; } struct Chan<T, S> { /// Notifies all tasks listening for the receiver being dropped notify_rx_closed: Notify, /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to channel's capacity. semaphore: S, ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
} /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
// ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner.sen...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
return; } notified.await; } } impl<T, S> Clone for Tx<T, S> { fn clone(&self) -> Tx<T, S> { // Using a Relaxed ordering here is sufficient as the caller holds a // strong ref to `self`, preventing a concurrent decrement to zero. self.inner.tx_count.fetch_add(1, Relaxed);...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; if rx_fields.rx_closed { return; } rx_fields.rx_closed = true; }); self.inner.semaphore.close(); self.inner.notify_rx_closed.notify_w...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
coop.made_progress(); return Ready(None); } None => {} // fall through } }; } try_recv!(); self.inner.rx_waker.register_by_ref(cx.waker()); // It is possible...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
} } // ===== impl Chan ===== impl<T, S> Chan<T, S> { fn send(&self, value: T) { // Push the value self.tx.push(value); // Notify the rx task self.rx_waker.wake(); } } impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
fn close(&self) { self.0.close(); } fn is_closed(&self) -> bool { self.0.is_closed() } } // ===== impl Semaphore for AtomicUsize ===== use std::sync::atomic::Ordering::{Acquire, Release}; use std::usize; impl Semaphore for AtomicUsize { fn add_permit(&self) { let prev = self....
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e4f76688a00fa2ce81ab6c074700995095c29e1e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e4f76688a00fa2ce81ab6c074700995095c29e1e/tokio/src/sync/mpsc/chan.rs
321
357
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
coop.made_progress(); return Ready(None); } None => {} // fall through } }; } try_recv!(); self.inner.rx_waker.register_by_ref(cx.waker()); // It is possible...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e06b257e09b8ca1def4a3537a4448a31f2ede388
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e06b257e09b8ca1def4a3537a4448a31f2ede388/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
self.inner.semaphore.add_permit(); Ok(value) } Some(Closed) => Err(TryRecvError::Closed), None => Err(TryRecvError::Empty), } }) } } } impl<T, S: Semaphore> Drop for Rx<T, S> { fn drop(&mut s...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e06b257e09b8ca1def4a3537a4448a31f2ede388
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e06b257e09b8ca1def4a3537a4448a31f2ede388/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and eing // inside its own Drop means we're the last ones to touch it. self.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e06b257e09b8ca1def4a3537a4448a31f2ede388
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e06b257e09b8ca1def4a3537a4448a31f2ede388/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
fn add_permit(&self) { let prev = self.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { self.load(Acquire) >> 1 == 0 } fn close(&self) { self.fetch_or(1, Release); }...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
e06b257e09b8ca1def4a3537a4448a31f2ede388
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e06b257e09b8ca1def4a3537a4448a31f2ede388/tokio/src/sync/mpsc/chan.rs
361
381
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
// ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner.sen...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
impl<T, S> Clone for Tx<T, S> { fn clone(&self) -> Tx<T, S> { // Using a Relaxed ordering here is sufficient as the caller holds a // strong ref to `self`, preventing a concurrent decrement to zero. self.inner.tx_count.fetch_add(1, Relaxed); Tx { inner: self.inner.clone(...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} rx_fields.rx_closed = true; }); self.inner.semaphore.close(); self.inner.notify_rx_closed.notify_waiters(); } /// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; // Keep track...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
}; } try_recv!(); self.inner.rx_waker.register_by_ref(cx.waker()); // It is possible that a value was pushed between attempting to read // and registering the task, so we have to check the channel a // second time here. try_recv!(); ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
} }) } } } impl<T, S: Semaphore> Drop for Rx<T, S> { fn drop(&mut self) { use super::block::Read::Value; self.close(); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
self.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) = rx_fields.list.pop(&self.tx) {} unsafe { rx_fields.list.free_blocks() }; }); } } // ===== impl Semaphore for (::Semaphore, capacity) ===== impl Semaphor...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
321
376
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
process::abort(); } } fn is_idle(&self) -> bool { self.load(Acquire) >> 1 == 0 } fn close(&self) { self.fetch_or(1, Release); } fn is_closed(&self) -> bool { self.load(Acquire) & 1 == 1 } }
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
a7833e300780546c091e606bb2e077542f2e2e4e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a7833e300780546c091e606bb2e077542f2e2e4e/tokio/src/sync/mpsc/chan.rs
361
376
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::notify::Notify; use std::fmt; use std::process; use std::sync::atomic::Ordering::{Ac...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
} } /// Fields only accessed by `Rx` handle. struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
} // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner....
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
} impl<T, S> Clone for Tx<T, S> { fn clone(&self) -> Tx<T, S> { // Using a Relaxed ordering here is sufficient as the caller holds a // strong ref to `self`, preventing a concurrent decrement to zero. self.inner.tx_count.fetch_add(1, Relaxed); Tx { inner: self.inner.clo...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
return; } rx_fields.rx_closed = true; }); self.inner.semaphore.close(); self.inner.notify_rx_closed.notify_waiters(); } /// Receive the next value pub(crate) fn recv(&mut self, cx: &mut Context<'_>) -> Poll<Option<T>> { use super::block::Read::*; ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
} }; } try_recv!(); self.inner.rx_waker.register_by_ref(cx.waker()); // It is possible that a value was pushed between attempting to read // and registering the task, so we have to check the channel a // second time here. ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
fn drop(&mut self) { use super::block::Read::Value; self.close(); self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) = rx_fields.list.pop(&self.inner.tx) { self.inner.semaphore.add_pe...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
} // ===== impl Semaphore for (::Semaphore, capacity) ===== impl Semaphore for (crate::sync::batch_semaphore::Semaphore, usize) { fn add_permit(&self) { self.0.release(1) } fn is_idle(&self) -> bool { self.0.available_permits() == self.1 } fn close(&self) { self.0.close()...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
d0ebb4154748166a4ba07baa4b424a1c45efd219
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d0ebb4154748166a4ba07baa4b424a1c45efd219/tokio/src/sync/mpsc/chan.rs
321
369
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
} // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner....
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
// Polling the future once is guaranteed to return `Pending` as `watch` // only notifies using `notify_waiters`. crate::future::poll_fn(|cx| { let res = Pin::new(&mut notified).poll(cx); assert!(!res.is_ready()); Poll::Ready(()) }) .await; if ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
} } // ===== impl Rx ===== impl<T, S: Semaphore> Rx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Rx<T, S> { Rx { inner: chan } } pub(crate) fn close(&mut self) { self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; if rx_fiel...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
coop.made_progress(); return Ready(Some(value)); } Some(Closed) => { // TODO: This check may not be required as it most // likely can only return `true` at this point. A ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; match rx_fields.list.pop(&self.inner.tx) { Some(Value(value)) => { self.inner.semaphore.add_permit(); Ok(value) } ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
} impl<T, S> Drop for Chan<T, S> { fn drop(&mut self) { use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and eing // inside its own Drop means we're the last ones to touch it. self.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = un...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
use std::usize; impl Semaphore for AtomicUsize { fn add_permit(&self) { let prev = self.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { self.load(Acquire) >> 1 == 0 } fn c...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
8880222036f37c6204c8466f25e828447f16dacb
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/sync/mpsc/chan.rs
361
384
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use crate::sync::Notify; use std::fmt; use std::process; use std::sync::atomic::Ordering::{AcqRel, Re...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
b5750825431afe6fe227a6fcf30a593b51ceff1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b5750825431afe6fe227a6fcf30a593b51ceff1b/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
} // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner....
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
078d0a2ebc4d4f88cb6bce05c8ac4f5038dae9be
github
async-runtime
https://github.com/tokio-rs/tokio/blob/078d0a2ebc4d4f88cb6bce05c8ac4f5038dae9be/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
} // ===== impl Tx ===== impl<T, S> Tx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner....
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
let res = Pin::new(&mut notified).poll(cx); assert!(!res.is_ready()); Poll::Ready(()) }) .await; if self.inner.semaphore.is_closed() { return; } notified.await; } } impl<T, S> Clone for Tx<T, S> { fn clone(&self) -> Tx<T, S> { ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
161
220
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:6
impl<T, S: Semaphore> Rx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Rx<T, S> { Rx { inner: chan } } pub(crate) fn close(&mut self) { self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; if rx_fields.rx_closed { ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
201
260
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:7
// TODO: This check may not be required as it most // likely can only return `true` at this point. A // channel is closed when all tx handles are // dropped. Dropping a tx handle releases memory, // which ens...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
241
300
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:8
self.inner.semaphore.add_permit(); Ok(value) } Some(Closed) => Err(TryRecvError::Closed), None => Err(TryRecvError::Empty), } }) } } impl<T, S: Semaphore> Drop for Rx<T, S> { fn drop(&mut self) { use super::block::R...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
281
340
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:9
use super::block::Read::Value; // Safety: the only owner of the rx fields is Chan, and eing // inside its own Drop means we're the last ones to touch it. self.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsafe { &mut *rx_fields_ptr }; while let Some(Value(_)) =...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
321
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:10
let prev = self.fetch_sub(2, Release); if prev >> 1 == 0 { // Something went wrong process::abort(); } } fn is_idle(&self) -> bool { self.load(Acquire) >> 1 == 0 } fn close(&self) { self.fetch_or(1, Release); } fn is_closed(&self) -> bo...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/55d932a21fd4c5fa298ca3cfdcb1388dbbf43dd0/tokio/src/sync/mpsc/chan.rs
361
380
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:1
use crate::loom::cell::UnsafeCell; use crate::loom::future::AtomicWaker; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Arc; use crate::sync::mpsc::error::TryRecvError; use crate::sync::mpsc::list; use std::fmt; use std::process; use std::sync::atomic::Ordering::{AcqRel, Relaxed}; use std::task::Po...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/chan.rs
1
60
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:2
fn close(&self); fn is_closed(&self) -> bool; } struct Chan<T, S> { /// Handle to the push half of the lock-free list. tx: list::Tx<T>, /// Coordinates access to channel's capacity. semaphore: S, /// Receiver waker. Notified when a value is pushed into the channel. rx_waker: AtomicWaker,...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/chan.rs
41
100
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:3
struct RxFields<T> { /// Channel receiver. This field is only accessed by the `Receiver` type. list: list::Rx<T>, /// `true` if `Rx::close` is called. rx_closed: bool, } impl<T> fmt::Debug for RxFields<T> { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("RxFi...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/chan.rs
81
140
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:4
fn new(chan: Arc<Chan<T, S>>) -> Tx<T, S> { Tx { inner: chan } } pub(super) fn semaphore(&self) -> &S { &self.inner.semaphore } /// Send a message and notify the receiver. pub(crate) fn send(&self, value: T) { self.inner.send(value); } /// Wake the receive half ...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/chan.rs
121
180
tokio-rs/tokio:tokio/src/sync/mpsc/chan.rs:5
// Notify the receiver self.wake_rx(); } } // ===== impl Rx ===== impl<T, S: Semaphore> Rx<T, S> { fn new(chan: Arc<Chan<T, S>>) -> Rx<T, S> { Rx { inner: chan } } pub(crate) fn close(&mut self) { self.inner.rx_fields.with_mut(|rx_fields_ptr| { let rx_fields = unsa...
rust
rust
macro-heavy
tokio-rs/tokio
tokio/src/sync/mpsc/chan.rs
MIT
cf025ba45f68934ae2138bb75ee2a5ee50506d1b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cf025ba45f68934ae2138bb75ee2a5ee50506d1b/tokio/src/sync/mpsc/chan.rs
161
220