crossbeam-channel/src/flavors/array.rs
Line | Count | Source (jump to first uncovered line) |
1 | | //! Bounded channel based on a preallocated array. |
2 | | //! |
3 | | //! This flavor has a fixed, positive capacity. |
4 | | //! |
5 | | //! The implementation is based on Dmitry Vyukov's bounded MPMC queue. |
6 | | //! |
7 | | //! Source: |
8 | | //! - <http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue> |
9 | | //! - <https://docs.google.com/document/d/1yIAYmbvL3JxOKOjuCyon7JhW4cSv1wy5hC0ApeGMV9s/pub> |
10 | | |
11 | | use std::cell::UnsafeCell; |
12 | | use std::marker::PhantomData; |
13 | | use std::mem::{self, MaybeUninit}; |
14 | | use std::ptr; |
15 | | use std::sync::atomic::{self, AtomicUsize, Ordering}; |
16 | | use std::time::Instant; |
17 | | |
18 | | use crossbeam_utils::{Backoff, CachePadded}; |
19 | | |
20 | | use crate::context::Context; |
21 | | use crate::err::{RecvTimeoutError, SendTimeoutError, TryRecvError, TrySendError}; |
22 | | use crate::select::{Operation, SelectHandle, Selected, Token}; |
23 | | use crate::waker::SyncWaker; |
24 | | |
25 | | /// A slot in a channel. |
26 | | struct Slot<T> { |
27 | | /// The current stamp. |
28 | | stamp: AtomicUsize, |
29 | | |
30 | | /// The message in this slot. |
31 | | msg: UnsafeCell<MaybeUninit<T>>, |
32 | | } |
33 | | |
34 | | /// The token type for the array flavor. |
35 | 0 | #[derive(Debug)] |
36 | | pub struct ArrayToken { |
37 | | /// Slot to read from or write to. |
38 | | slot: *const u8, |
39 | | |
40 | | /// Stamp to store into the slot after reading or writing. |
41 | | stamp: usize, |
42 | | } |
43 | | |
44 | | impl Default for ArrayToken { |
45 | | #[inline] |
46 | 88.1M | fn default() -> Self { |
47 | 88.1M | ArrayToken { |
48 | 88.1M | slot: ptr::null(), |
49 | 88.1M | stamp: 0, |
50 | 88.1M | } |
51 | 88.1M | } <crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 730k | fn default() -> Self { | 47 | 730k | ArrayToken { | 48 | 730k | slot: ptr::null(), | 49 | 730k | stamp: 0, | 50 | 730k | } | 51 | 730k | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 9.91M | fn default() -> Self { | 47 | 9.91M | ArrayToken { | 48 | 9.91M | slot: ptr::null(), | 49 | 9.91M | stamp: 0, | 50 | 9.91M | } | 51 | 9.91M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 5.38M | fn default() -> Self { | 47 | 5.38M | ArrayToken { | 48 | 5.38M | slot: ptr::null(), | 49 | 5.38M | stamp: 0, | 50 | 5.38M | } | 51 | 5.38M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 279k | fn default() -> Self { | 47 | 279k | ArrayToken { | 48 | 279k | slot: ptr::null(), | 49 | 279k | stamp: 0, | 50 | 279k | } | 51 | 279k | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 1.55M | fn default() -> Self { | 47 | 1.55M | ArrayToken { | 48 | 1.55M | slot: ptr::null(), | 49 | 1.55M | stamp: 0, | 50 | 1.55M | } | 51 | 1.55M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 126 | fn default() -> Self { | 47 | 126 | ArrayToken { | 48 | 126 | slot: ptr::null(), | 49 | 126 | stamp: 0, | 50 | 126 | } | 51 | 126 | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 3 | fn default() -> Self { | 47 | 3 | ArrayToken { | 48 | 3 | slot: ptr::null(), | 49 | 3 | stamp: 0, | 50 | 3 | } | 51 | 3 | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 1.55M | fn default() -> Self { | 47 | 1.55M | ArrayToken { | 48 | 1.55M | slot: ptr::null(), | 49 | 1.55M | stamp: 0, | 50 | 1.55M | } | 51 | 1.55M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 1.48M | fn default() -> Self { | 47 | 1.48M | ArrayToken { | 48 | 1.48M | slot: ptr::null(), | 49 | 1.48M | stamp: 0, | 50 | 1.48M | } | 51 | 1.48M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 66.9M | fn default() -> Self { | 47 | 66.9M | ArrayToken { | 48 | 66.9M | slot: ptr::null(), | 49 | 66.9M | stamp: 0, | 50 | 66.9M | } | 51 | 66.9M | } |
<crossbeam_channel::flavors::array::ArrayToken as core::default::Default>::default Line | Count | Source | 46 | 290k | fn default() -> Self { | 47 | 290k | ArrayToken { | 48 | 290k | slot: ptr::null(), | 49 | 290k | stamp: 0, | 50 | 290k | } | 51 | 290k | } |
|
52 | | } |
53 | | |
54 | | /// Bounded channel based on a preallocated array. |
55 | | pub(crate) struct Channel<T> { |
56 | | /// The head of the channel. |
57 | | /// |
58 | | /// This value is a "stamp" consisting of an index into the buffer, a mark bit, and a lap, but |
59 | | /// packed into a single `usize`. The lower bits represent the index, while the upper bits |
60 | | /// represent the lap. The mark bit in the head is always zero. |
61 | | /// |
62 | | /// Messages are popped from the head of the channel. |
63 | | head: CachePadded<AtomicUsize>, |
64 | | |
65 | | /// The tail of the channel. |
66 | | /// |
67 | | /// This value is a "stamp" consisting of an index into the buffer, a mark bit, and a lap, but |
68 | | /// packed into a single `usize`. The lower bits represent the index, while the upper bits |
69 | | /// represent the lap. The mark bit indicates that the channel is disconnected. |
70 | | /// |
71 | | /// Messages are pushed into the tail of the channel. |
72 | | tail: CachePadded<AtomicUsize>, |
73 | | |
74 | | /// The buffer holding slots. |
75 | | buffer: *mut Slot<T>, |
76 | | |
77 | | /// The channel capacity. |
78 | | cap: usize, |
79 | | |
80 | | /// A stamp with the value of `{ lap: 1, mark: 0, index: 0 }`. |
81 | | one_lap: usize, |
82 | | |
83 | | /// If this bit is set in the tail, that means the channel is disconnected. |
84 | | mark_bit: usize, |
85 | | |
86 | | /// Senders waiting while the channel is full. |
87 | | senders: SyncWaker, |
88 | | |
89 | | /// Receivers waiting while the channel is empty and not disconnected. |
90 | | receivers: SyncWaker, |
91 | | |
92 | | /// Indicates that dropping a `Channel<T>` may drop values of type `T`. |
93 | | _marker: PhantomData<T>, |
94 | | } |
95 | | |
96 | | impl<T> Channel<T> { |
97 | | /// Creates a bounded channel of capacity `cap`. |
98 | 33.5k | pub(crate) fn with_capacity(cap: usize) -> Self { |
99 | 33.5k | assert!(cap > 0, "capacity must be positive"); |
100 | | |
101 | | // Compute constants `mark_bit` and `one_lap`. |
102 | 33.5k | let mark_bit = (cap + 1).next_power_of_two(); |
103 | 33.5k | let one_lap = mark_bit * 2; |
104 | 33.5k | |
105 | 33.5k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. |
106 | 33.5k | let head = 0; |
107 | 33.5k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. |
108 | 33.5k | let tail = 0; |
109 | 33.5k | |
110 | 33.5k | // Allocate a buffer of `cap` slots initialized |
111 | 33.5k | // with stamps. |
112 | 33.5k | let buffer = { |
113 | 33.5k | let mut boxed: Box<[Slot<T>]> = (0..cap) |
114 | 242k | .map(|i| { |
115 | 242k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. |
116 | 242k | Slot { |
117 | 242k | stamp: AtomicUsize::new(i), |
118 | 242k | msg: UnsafeCell::new(MaybeUninit::uninit()), |
119 | 242k | } |
120 | 242k | }) <crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 10.0k | .map(|i| { | 115 | 10.0k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 10.0k | Slot { | 117 | 10.0k | stamp: AtomicUsize::new(i), | 118 | 10.0k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 10.0k | } | 120 | 10.0k | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 4 | .map(|i| { | 115 | 4 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 4 | Slot { | 117 | 4 | stamp: AtomicUsize::new(i), | 118 | 4 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 4 | } | 120 | 4 | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 7 | .map(|i| { | 115 | 7 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 7 | Slot { | 117 | 7 | stamp: AtomicUsize::new(i), | 118 | 7 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 7 | } | 120 | 7 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 3.00k | .map(|i| { | 115 | 3.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 3.00k | Slot { | 117 | 3.00k | stamp: AtomicUsize::new(i), | 118 | 3.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 3.00k | } | 120 | 3.00k | }) |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity::{closure#0} Line | Count | Source | 114 | 10.4k | .map(|i| { | 115 | 10.4k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 10.4k | Slot { | 117 | 10.4k | stamp: AtomicUsize::new(i), | 118 | 10.4k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 10.4k | } | 120 | 10.4k | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity::{closure#0} Line | Count | Source | 114 | 10.5k | .map(|i| { | 115 | 10.5k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 10.5k | Slot { | 117 | 10.5k | stamp: AtomicUsize::new(i), | 118 | 10.5k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 10.5k | } | 120 | 10.5k | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 12 | .map(|i| { | 115 | 12 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 12 | Slot { | 117 | 12 | stamp: AtomicUsize::new(i), | 118 | 12 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 12 | } | 120 | 12 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1.00k | .map(|i| { | 115 | 1.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1.00k | Slot { | 117 | 1.00k | stamp: AtomicUsize::new(i), | 118 | 1.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1.00k | } | 120 | 1.00k | }) |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::with_capacity::{closure#0} Line | Count | Source | 114 | 5.00k | .map(|i| { | 115 | 5.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 5.00k | Slot { | 117 | 5.00k | stamp: AtomicUsize::new(i), | 118 | 5.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 5.00k | } | 120 | 5.00k | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 10.5k | .map(|i| { | 115 | 10.5k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 10.5k | Slot { | 117 | 10.5k | stamp: AtomicUsize::new(i), | 118 | 10.5k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 10.5k | } | 120 | 10.5k | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1.00k | .map(|i| { | 115 | 1.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1.00k | Slot { | 117 | 1.00k | stamp: AtomicUsize::new(i), | 118 | 1.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1.00k | } | 120 | 1.00k | }) |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity::{closure#0} Line | Count | Source | 114 | 24.4k | .map(|i| { | 115 | 24.4k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 24.4k | Slot { | 117 | 24.4k | stamp: AtomicUsize::new(i), | 118 | 24.4k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 24.4k | } | 120 | 24.4k | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 2 | .map(|i| { | 115 | 2 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 2 | Slot { | 117 | 2 | stamp: AtomicUsize::new(i), | 118 | 2 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 2 | } | 120 | 2 | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 2 | .map(|i| { | 115 | 2 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 2 | Slot { | 117 | 2 | stamp: AtomicUsize::new(i), | 118 | 2 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 2 | } | 120 | 2 | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 108k | .map(|i| { | 115 | 108k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 108k | Slot { | 117 | 108k | stamp: AtomicUsize::new(i), | 118 | 108k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 108k | } | 120 | 108k | }) |
<crossbeam_channel::flavors::array::Channel<u32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 2 | .map(|i| { | 115 | 2 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 2 | Slot { | 117 | 2 | stamp: AtomicUsize::new(i), | 118 | 2 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 2 | } | 120 | 2 | }) |
<crossbeam_channel::flavors::array::Channel<bool>>::with_capacity::{closure#0} Line | Count | Source | 114 | 2 | .map(|i| { | 115 | 2 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 2 | Slot { | 117 | 2 | stamp: AtomicUsize::new(i), | 118 | 2 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 2 | } | 120 | 2 | }) |
<crossbeam_channel::flavors::array::Channel<u8>>::with_capacity::{closure#0} Line | Count | Source | 114 | 20.0k | .map(|i| { | 115 | 20.0k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 20.0k | Slot { | 117 | 20.0k | stamp: AtomicUsize::new(i), | 118 | 20.0k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 20.0k | } | 120 | 20.0k | }) |
<crossbeam_channel::flavors::array::Channel<i64>>::with_capacity::{closure#0} Line | Count | Source | 114 | 1 | .map(|i| { | 115 | 1 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 1 | Slot { | 117 | 1 | stamp: AtomicUsize::new(i), | 118 | 1 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 1 | } | 120 | 1 | }) |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity::{closure#0} Line | Count | Source | 114 | 18.8k | .map(|i| { | 115 | 18.8k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 18.8k | Slot { | 117 | 18.8k | stamp: AtomicUsize::new(i), | 118 | 18.8k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 18.8k | } | 120 | 18.8k | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 7 | .map(|i| { | 115 | 7 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 7 | Slot { | 117 | 7 | stamp: AtomicUsize::new(i), | 118 | 7 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 7 | } | 120 | 7 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 3.00k | .map(|i| { | 115 | 3.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 3.00k | Slot { | 117 | 3.00k | stamp: AtomicUsize::new(i), | 118 | 3.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 3.00k | } | 120 | 3.00k | }) |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity::{closure#0} Line | Count | Source | 114 | 4 | .map(|i| { | 115 | 4 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 4 | Slot { | 117 | 4 | stamp: AtomicUsize::new(i), | 118 | 4 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 4 | } | 120 | 4 | }) |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity::{closure#0} Line | Count | Source | 114 | 10.0k | .map(|i| { | 115 | 10.0k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 10.0k | Slot { | 117 | 10.0k | stamp: AtomicUsize::new(i), | 118 | 10.0k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 10.0k | } | 120 | 10.0k | }) |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity::{closure#0} Line | Count | Source | 114 | 7 | .map(|i| { | 115 | 7 | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 7 | Slot { | 117 | 7 | stamp: AtomicUsize::new(i), | 118 | 7 | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 7 | } | 120 | 7 | }) |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity::{closure#0} Line | Count | Source | 114 | 6.00k | .map(|i| { | 115 | 6.00k | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | 6.00k | Slot { | 117 | 6.00k | stamp: AtomicUsize::new(i), | 118 | 6.00k | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | 6.00k | } | 120 | 6.00k | }) |
|
121 | 33.5k | .collect(); |
122 | 33.5k | let ptr = boxed.as_mut_ptr(); |
123 | 33.5k | mem::forget(boxed); |
124 | 33.5k | ptr |
125 | 33.5k | }; |
126 | 33.5k | |
127 | 33.5k | Channel { |
128 | 33.5k | buffer, |
129 | 33.5k | cap, |
130 | 33.5k | one_lap, |
131 | 33.5k | mark_bit, |
132 | 33.5k | head: CachePadded::new(AtomicUsize::new(head)), |
133 | 33.5k | tail: CachePadded::new(AtomicUsize::new(tail)), |
134 | 33.5k | senders: SyncWaker::new(), |
135 | 33.5k | receivers: SyncWaker::new(), |
136 | 33.5k | _marker: PhantomData, |
137 | 33.5k | } |
138 | 33.5k | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::with_capacity Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::with_capacity <crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 10.0k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 10.0k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 10.0k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 10.0k | let one_lap = mark_bit * 2; | 104 | 10.0k | | 105 | 10.0k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 10.0k | let head = 0; | 107 | 10.0k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 10.0k | let tail = 0; | 109 | 10.0k | | 110 | 10.0k | // Allocate a buffer of `cap` slots initialized | 111 | 10.0k | // with stamps. | 112 | 10.0k | let buffer = { | 113 | 10.0k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 10.0k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 10.0k | }) | 121 | 10.0k | .collect(); | 122 | 10.0k | let ptr = boxed.as_mut_ptr(); | 123 | 10.0k | mem::forget(boxed); | 124 | 10.0k | ptr | 125 | 10.0k | }; | 126 | 10.0k | | 127 | 10.0k | Channel { | 128 | 10.0k | buffer, | 129 | 10.0k | cap, | 130 | 10.0k | one_lap, | 131 | 10.0k | mark_bit, | 132 | 10.0k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 10.0k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 10.0k | senders: SyncWaker::new(), | 135 | 10.0k | receivers: SyncWaker::new(), | 136 | 10.0k | _marker: PhantomData, | 137 | 10.0k | } | 138 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity Line | Count | Source | 98 | 6 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 6 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 6 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 6 | let one_lap = mark_bit * 2; | 104 | 6 | | 105 | 6 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 6 | let head = 0; | 107 | 6 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 6 | let tail = 0; | 109 | 6 | | 110 | 6 | // Allocate a buffer of `cap` slots initialized | 111 | 6 | // with stamps. | 112 | 6 | let buffer = { | 113 | 6 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 6 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 6 | }) | 121 | 6 | .collect(); | 122 | 6 | let ptr = boxed.as_mut_ptr(); | 123 | 6 | mem::forget(boxed); | 124 | 6 | ptr | 125 | 6 | }; | 126 | 6 | | 127 | 6 | Channel { | 128 | 6 | buffer, | 129 | 6 | cap, | 130 | 6 | one_lap, | 131 | 6 | mark_bit, | 132 | 6 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 6 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 6 | senders: SyncWaker::new(), | 135 | 6 | receivers: SyncWaker::new(), | 136 | 6 | _marker: PhantomData, | 137 | 6 | } | 138 | 6 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity Line | Count | Source | 98 | 2.00k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2.00k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2.00k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2.00k | let one_lap = mark_bit * 2; | 104 | 2.00k | | 105 | 2.00k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2.00k | let head = 0; | 107 | 2.00k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2.00k | let tail = 0; | 109 | 2.00k | | 110 | 2.00k | // Allocate a buffer of `cap` slots initialized | 111 | 2.00k | // with stamps. | 112 | 2.00k | let buffer = { | 113 | 2.00k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2.00k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2.00k | }) | 121 | 2.00k | .collect(); | 122 | 2.00k | let ptr = boxed.as_mut_ptr(); | 123 | 2.00k | mem::forget(boxed); | 124 | 2.00k | ptr | 125 | 2.00k | }; | 126 | 2.00k | | 127 | 2.00k | Channel { | 128 | 2.00k | buffer, | 129 | 2.00k | cap, | 130 | 2.00k | one_lap, | 131 | 2.00k | mark_bit, | 132 | 2.00k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2.00k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2.00k | senders: SyncWaker::new(), | 135 | 2.00k | receivers: SyncWaker::new(), | 136 | 2.00k | _marker: PhantomData, | 137 | 2.00k | } | 138 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 4 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 4 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 4 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 4 | let one_lap = mark_bit * 2; | 104 | 4 | | 105 | 4 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 4 | let head = 0; | 107 | 4 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 4 | let tail = 0; | 109 | 4 | | 110 | 4 | // Allocate a buffer of `cap` slots initialized | 111 | 4 | // with stamps. | 112 | 4 | let buffer = { | 113 | 4 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 4 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 4 | }) | 121 | 4 | .collect(); | 122 | 4 | let ptr = boxed.as_mut_ptr(); | 123 | 4 | mem::forget(boxed); | 124 | 4 | ptr | 125 | 4 | }; | 126 | 4 | | 127 | 4 | Channel { | 128 | 4 | buffer, | 129 | 4 | cap, | 130 | 4 | one_lap, | 131 | 4 | mark_bit, | 132 | 4 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 4 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 4 | senders: SyncWaker::new(), | 135 | 4 | receivers: SyncWaker::new(), | 136 | 4 | _marker: PhantomData, | 137 | 4 | } | 138 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 12 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 12 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 12 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 12 | let one_lap = mark_bit * 2; | 104 | 12 | | 105 | 12 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 12 | let head = 0; | 107 | 12 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 12 | let tail = 0; | 109 | 12 | | 110 | 12 | // Allocate a buffer of `cap` slots initialized | 111 | 12 | // with stamps. | 112 | 12 | let buffer = { | 113 | 12 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 12 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 12 | }) | 121 | 12 | .collect(); | 122 | 12 | let ptr = boxed.as_mut_ptr(); | 123 | 12 | mem::forget(boxed); | 124 | 12 | ptr | 125 | 12 | }; | 126 | 12 | | 127 | 12 | Channel { | 128 | 12 | buffer, | 129 | 12 | cap, | 130 | 12 | one_lap, | 131 | 12 | mark_bit, | 132 | 12 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 12 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 12 | senders: SyncWaker::new(), | 135 | 12 | receivers: SyncWaker::new(), | 136 | 12 | _marker: PhantomData, | 137 | 12 | } | 138 | 12 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity Line | Count | Source | 98 | 203 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 203 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 203 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 203 | let one_lap = mark_bit * 2; | 104 | 203 | | 105 | 203 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 203 | let head = 0; | 107 | 203 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 203 | let tail = 0; | 109 | 203 | | 110 | 203 | // Allocate a buffer of `cap` slots initialized | 111 | 203 | // with stamps. | 112 | 203 | let buffer = { | 113 | 203 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 203 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 203 | }) | 121 | 203 | .collect(); | 122 | 203 | let ptr = boxed.as_mut_ptr(); | 123 | 203 | mem::forget(boxed); | 124 | 203 | ptr | 125 | 203 | }; | 126 | 203 | | 127 | 203 | Channel { | 128 | 203 | buffer, | 129 | 203 | cap, | 130 | 203 | one_lap, | 131 | 203 | mark_bit, | 132 | 203 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 203 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 203 | senders: SyncWaker::new(), | 135 | 203 | receivers: SyncWaker::new(), | 136 | 203 | _marker: PhantomData, | 137 | 203 | } | 138 | 203 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 5 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 5 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 5 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 5 | let one_lap = mark_bit * 2; | 104 | 5 | | 105 | 5 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 5 | let head = 0; | 107 | 5 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 5 | let tail = 0; | 109 | 5 | | 110 | 5 | // Allocate a buffer of `cap` slots initialized | 111 | 5 | // with stamps. | 112 | 5 | let buffer = { | 113 | 5 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 5 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 5 | }) | 121 | 5 | .collect(); | 122 | 5 | let ptr = boxed.as_mut_ptr(); | 123 | 5 | mem::forget(boxed); | 124 | 5 | ptr | 125 | 5 | }; | 126 | 5 | | 127 | 5 | Channel { | 128 | 5 | buffer, | 129 | 5 | cap, | 130 | 5 | one_lap, | 131 | 5 | mark_bit, | 132 | 5 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 5 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 5 | senders: SyncWaker::new(), | 135 | 5 | receivers: SyncWaker::new(), | 136 | 5 | _marker: PhantomData, | 137 | 5 | } | 138 | 5 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity Line | Count | Source | 98 | 1.00k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1.00k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1.00k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1.00k | let one_lap = mark_bit * 2; | 104 | 1.00k | | 105 | 1.00k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1.00k | let head = 0; | 107 | 1.00k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1.00k | let tail = 0; | 109 | 1.00k | | 110 | 1.00k | // Allocate a buffer of `cap` slots initialized | 111 | 1.00k | // with stamps. | 112 | 1.00k | let buffer = { | 113 | 1.00k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1.00k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1.00k | }) | 121 | 1.00k | .collect(); | 122 | 1.00k | let ptr = boxed.as_mut_ptr(); | 123 | 1.00k | mem::forget(boxed); | 124 | 1.00k | ptr | 125 | 1.00k | }; | 126 | 1.00k | | 127 | 1.00k | Channel { | 128 | 1.00k | buffer, | 129 | 1.00k | cap, | 130 | 1.00k | one_lap, | 131 | 1.00k | mark_bit, | 132 | 1.00k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1.00k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1.00k | senders: SyncWaker::new(), | 135 | 1.00k | receivers: SyncWaker::new(), | 136 | 1.00k | _marker: PhantomData, | 137 | 1.00k | } | 138 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity Line | Count | Source | 98 | 15 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 15 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 15 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 15 | let one_lap = mark_bit * 2; | 104 | 15 | | 105 | 15 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 15 | let head = 0; | 107 | 15 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 15 | let tail = 0; | 109 | 15 | | 110 | 15 | // Allocate a buffer of `cap` slots initialized | 111 | 15 | // with stamps. | 112 | 15 | let buffer = { | 113 | 15 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 15 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 15 | }) | 121 | 15 | .collect(); | 122 | 15 | let ptr = boxed.as_mut_ptr(); | 123 | 15 | mem::forget(boxed); | 124 | 15 | ptr | 125 | 15 | }; | 126 | 15 | | 127 | 15 | Channel { | 128 | 15 | buffer, | 129 | 15 | cap, | 130 | 15 | one_lap, | 131 | 15 | mark_bit, | 132 | 15 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 15 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 15 | senders: SyncWaker::new(), | 135 | 15 | receivers: SyncWaker::new(), | 136 | 15 | _marker: PhantomData, | 137 | 15 | } | 138 | 15 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 10.0k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 10.0k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 10.0k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 10.0k | let one_lap = mark_bit * 2; | 104 | 10.0k | | 105 | 10.0k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 10.0k | let head = 0; | 107 | 10.0k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 10.0k | let tail = 0; | 109 | 10.0k | | 110 | 10.0k | // Allocate a buffer of `cap` slots initialized | 111 | 10.0k | // with stamps. | 112 | 10.0k | let buffer = { | 113 | 10.0k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 10.0k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 10.0k | }) | 121 | 10.0k | .collect(); | 122 | 10.0k | let ptr = boxed.as_mut_ptr(); | 123 | 10.0k | mem::forget(boxed); | 124 | 10.0k | ptr | 125 | 10.0k | }; | 126 | 10.0k | | 127 | 10.0k | Channel { | 128 | 10.0k | buffer, | 129 | 10.0k | cap, | 130 | 10.0k | one_lap, | 131 | 10.0k | mark_bit, | 132 | 10.0k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 10.0k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 10.0k | senders: SyncWaker::new(), | 135 | 10.0k | receivers: SyncWaker::new(), | 136 | 10.0k | _marker: PhantomData, | 137 | 10.0k | } | 138 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::with_capacity Line | Count | Source | 98 | 100 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 100 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 100 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 100 | let one_lap = mark_bit * 2; | 104 | 100 | | 105 | 100 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 100 | let head = 0; | 107 | 100 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 100 | let tail = 0; | 109 | 100 | | 110 | 100 | // Allocate a buffer of `cap` slots initialized | 111 | 100 | // with stamps. | 112 | 100 | let buffer = { | 113 | 100 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 100 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 100 | }) | 121 | 100 | .collect(); | 122 | 100 | let ptr = boxed.as_mut_ptr(); | 123 | 100 | mem::forget(boxed); | 124 | 100 | ptr | 125 | 100 | }; | 126 | 100 | | 127 | 100 | Channel { | 128 | 100 | buffer, | 129 | 100 | cap, | 130 | 100 | one_lap, | 131 | 100 | mark_bit, | 132 | 100 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 100 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 100 | senders: SyncWaker::new(), | 135 | 100 | receivers: SyncWaker::new(), | 136 | 100 | _marker: PhantomData, | 137 | 100 | } | 138 | 100 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<[u8; 0]>>::with_capacity <crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 5.14k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 5.14k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 5.14k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 5.14k | let one_lap = mark_bit * 2; | 104 | 5.14k | | 105 | 5.14k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 5.14k | let head = 0; | 107 | 5.14k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 5.14k | let tail = 0; | 109 | 5.14k | | 110 | 5.14k | // Allocate a buffer of `cap` slots initialized | 111 | 5.14k | // with stamps. | 112 | 5.14k | let buffer = { | 113 | 5.14k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 5.14k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 5.14k | }) | 121 | 5.14k | .collect(); | 122 | 5.14k | let ptr = boxed.as_mut_ptr(); | 123 | 5.14k | mem::forget(boxed); | 124 | 5.14k | ptr | 125 | 5.14k | }; | 126 | 5.14k | | 127 | 5.14k | Channel { | 128 | 5.14k | buffer, | 129 | 5.14k | cap, | 130 | 5.14k | one_lap, | 131 | 5.14k | mark_bit, | 132 | 5.14k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 5.14k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 5.14k | senders: SyncWaker::new(), | 135 | 5.14k | receivers: SyncWaker::new(), | 136 | 5.14k | _marker: PhantomData, | 137 | 5.14k | } | 138 | 5.14k | } |
<crossbeam_channel::flavors::array::Channel<u8>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<golang::zerosize::zero_size_struct::ZeroSize>>::with_capacity <crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i64>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::with_capacity Line | Count | Source | 98 | 3 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 3 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 3 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 3 | let one_lap = mark_bit * 2; | 104 | 3 | | 105 | 3 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 3 | let head = 0; | 107 | 3 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 3 | let tail = 0; | 109 | 3 | | 110 | 3 | // Allocate a buffer of `cap` slots initialized | 111 | 3 | // with stamps. | 112 | 3 | let buffer = { | 113 | 3 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 3 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 3 | }) | 121 | 3 | .collect(); | 122 | 3 | let ptr = boxed.as_mut_ptr(); | 123 | 3 | mem::forget(boxed); | 124 | 3 | ptr | 125 | 3 | }; | 126 | 3 | | 127 | 3 | Channel { | 128 | 3 | buffer, | 129 | 3 | cap, | 130 | 3 | one_lap, | 131 | 3 | mark_bit, | 132 | 3 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 3 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 3 | senders: SyncWaker::new(), | 135 | 3 | receivers: SyncWaker::new(), | 136 | 3 | _marker: PhantomData, | 137 | 3 | } | 138 | 3 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::with_capacity Line | Count | Source | 98 | 1 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 1 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 1 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 1 | let one_lap = mark_bit * 2; | 104 | 1 | | 105 | 1 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 1 | let head = 0; | 107 | 1 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 1 | let tail = 0; | 109 | 1 | | 110 | 1 | // Allocate a buffer of `cap` slots initialized | 111 | 1 | // with stamps. | 112 | 1 | let buffer = { | 113 | 1 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 1 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 1 | }) | 121 | 1 | .collect(); | 122 | 1 | let ptr = boxed.as_mut_ptr(); | 123 | 1 | mem::forget(boxed); | 124 | 1 | ptr | 125 | 1 | }; | 126 | 1 | | 127 | 1 | Channel { | 128 | 1 | buffer, | 129 | 1 | cap, | 130 | 1 | one_lap, | 131 | 1 | mark_bit, | 132 | 1 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 1 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 1 | senders: SyncWaker::new(), | 135 | 1 | receivers: SyncWaker::new(), | 136 | 1 | _marker: PhantomData, | 137 | 1 | } | 138 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::with_capacity Line | Count | Source | 98 | 4 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 4 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 4 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 4 | let one_lap = mark_bit * 2; | 104 | 4 | | 105 | 4 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 4 | let head = 0; | 107 | 4 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 4 | let tail = 0; | 109 | 4 | | 110 | 4 | // Allocate a buffer of `cap` slots initialized | 111 | 4 | // with stamps. | 112 | 4 | let buffer = { | 113 | 4 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 4 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 4 | }) | 121 | 4 | .collect(); | 122 | 4 | let ptr = boxed.as_mut_ptr(); | 123 | 4 | mem::forget(boxed); | 124 | 4 | ptr | 125 | 4 | }; | 126 | 4 | | 127 | 4 | Channel { | 128 | 4 | buffer, | 129 | 4 | cap, | 130 | 4 | one_lap, | 131 | 4 | mark_bit, | 132 | 4 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 4 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 4 | senders: SyncWaker::new(), | 135 | 4 | receivers: SyncWaker::new(), | 136 | 4 | _marker: PhantomData, | 137 | 4 | } | 138 | 4 | } |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity Line | Count | Source | 98 | 7 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 7 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 7 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 7 | let one_lap = mark_bit * 2; | 104 | 7 | | 105 | 7 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 7 | let head = 0; | 107 | 7 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 7 | let tail = 0; | 109 | 7 | | 110 | 7 | // Allocate a buffer of `cap` slots initialized | 111 | 7 | // with stamps. | 112 | 7 | let buffer = { | 113 | 7 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 7 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 7 | }) | 121 | 7 | .collect(); | 122 | 7 | let ptr = boxed.as_mut_ptr(); | 123 | 7 | mem::forget(boxed); | 124 | 7 | ptr | 125 | 7 | }; | 126 | 7 | | 127 | 7 | Channel { | 128 | 7 | buffer, | 129 | 7 | cap, | 130 | 7 | one_lap, | 131 | 7 | mark_bit, | 132 | 7 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 7 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 7 | senders: SyncWaker::new(), | 135 | 7 | receivers: SyncWaker::new(), | 136 | 7 | _marker: PhantomData, | 137 | 7 | } | 138 | 7 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity Line | Count | Source | 98 | 2.00k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2.00k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2.00k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2.00k | let one_lap = mark_bit * 2; | 104 | 2.00k | | 105 | 2.00k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2.00k | let head = 0; | 107 | 2.00k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2.00k | let tail = 0; | 109 | 2.00k | | 110 | 2.00k | // Allocate a buffer of `cap` slots initialized | 111 | 2.00k | // with stamps. | 112 | 2.00k | let buffer = { | 113 | 2.00k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2.00k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2.00k | }) | 121 | 2.00k | .collect(); | 122 | 2.00k | let ptr = boxed.as_mut_ptr(); | 123 | 2.00k | mem::forget(boxed); | 124 | 2.00k | ptr | 125 | 2.00k | }; | 126 | 2.00k | | 127 | 2.00k | Channel { | 128 | 2.00k | buffer, | 129 | 2.00k | cap, | 130 | 2.00k | one_lap, | 131 | 2.00k | mark_bit, | 132 | 2.00k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2.00k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2.00k | senders: SyncWaker::new(), | 135 | 2.00k | receivers: SyncWaker::new(), | 136 | 2.00k | _marker: PhantomData, | 137 | 2.00k | } | 138 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::with_capacity Line | Count | Source | 98 | 2 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 2 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 2 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 2 | let one_lap = mark_bit * 2; | 104 | 2 | | 105 | 2 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 2 | let head = 0; | 107 | 2 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 2 | let tail = 0; | 109 | 2 | | 110 | 2 | // Allocate a buffer of `cap` slots initialized | 111 | 2 | // with stamps. | 112 | 2 | let buffer = { | 113 | 2 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 2 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 2 | }) | 121 | 2 | .collect(); | 122 | 2 | let ptr = boxed.as_mut_ptr(); | 123 | 2 | mem::forget(boxed); | 124 | 2 | ptr | 125 | 2 | }; | 126 | 2 | | 127 | 2 | Channel { | 128 | 2 | buffer, | 129 | 2 | cap, | 130 | 2 | one_lap, | 131 | 2 | mark_bit, | 132 | 2 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 2 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 2 | senders: SyncWaker::new(), | 135 | 2 | receivers: SyncWaker::new(), | 136 | 2 | _marker: PhantomData, | 137 | 2 | } | 138 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::with_capacity <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::with_capacity Line | Count | Source | 98 | 3.00k | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 3.00k | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 3.00k | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 3.00k | let one_lap = mark_bit * 2; | 104 | 3.00k | | 105 | 3.00k | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 3.00k | let head = 0; | 107 | 3.00k | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 3.00k | let tail = 0; | 109 | 3.00k | | 110 | 3.00k | // Allocate a buffer of `cap` slots initialized | 111 | 3.00k | // with stamps. | 112 | 3.00k | let buffer = { | 113 | 3.00k | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 3.00k | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 3.00k | }) | 121 | 3.00k | .collect(); | 122 | 3.00k | let ptr = boxed.as_mut_ptr(); | 123 | 3.00k | mem::forget(boxed); | 124 | 3.00k | ptr | 125 | 3.00k | }; | 126 | 3.00k | | 127 | 3.00k | Channel { | 128 | 3.00k | buffer, | 129 | 3.00k | cap, | 130 | 3.00k | one_lap, | 131 | 3.00k | mark_bit, | 132 | 3.00k | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 3.00k | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 3.00k | senders: SyncWaker::new(), | 135 | 3.00k | receivers: SyncWaker::new(), | 136 | 3.00k | _marker: PhantomData, | 137 | 3.00k | } | 138 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::with_capacity Line | Count | Source | 98 | 4 | pub(crate) fn with_capacity(cap: usize) -> Self { | 99 | 4 | assert!(cap > 0, "capacity must be positive"); | 100 | | | 101 | | // Compute constants `mark_bit` and `one_lap`. | 102 | 4 | let mark_bit = (cap + 1).next_power_of_two(); | 103 | 4 | let one_lap = mark_bit * 2; | 104 | 4 | | 105 | 4 | // Head is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 106 | 4 | let head = 0; | 107 | 4 | // Tail is initialized to `{ lap: 0, mark: 0, index: 0 }`. | 108 | 4 | let tail = 0; | 109 | 4 | | 110 | 4 | // Allocate a buffer of `cap` slots initialized | 111 | 4 | // with stamps. | 112 | 4 | let buffer = { | 113 | 4 | let mut boxed: Box<[Slot<T>]> = (0..cap) | 114 | 4 | .map(|i| { | 115 | | // Set the stamp to `{ lap: 0, mark: 0, index: i }`. | 116 | | Slot { | 117 | | stamp: AtomicUsize::new(i), | 118 | | msg: UnsafeCell::new(MaybeUninit::uninit()), | 119 | | } | 120 | 4 | }) | 121 | 4 | .collect(); | 122 | 4 | let ptr = boxed.as_mut_ptr(); | 123 | 4 | mem::forget(boxed); | 124 | 4 | ptr | 125 | 4 | }; | 126 | 4 | | 127 | 4 | Channel { | 128 | 4 | buffer, | 129 | 4 | cap, | 130 | 4 | one_lap, | 131 | 4 | mark_bit, | 132 | 4 | head: CachePadded::new(AtomicUsize::new(head)), | 133 | 4 | tail: CachePadded::new(AtomicUsize::new(tail)), | 134 | 4 | senders: SyncWaker::new(), | 135 | 4 | receivers: SyncWaker::new(), | 136 | 4 | _marker: PhantomData, | 137 | 4 | } | 138 | 4 | } |
|
139 | | |
140 | | /// Returns a receiver handle to the channel. |
141 | 811k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { |
142 | 811k | Receiver(self) |
143 | 811k | } <crossbeam_channel::flavors::array::Channel<()>>::receiver Line | Count | Source | 141 | 8.68k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 8.68k | Receiver(self) | 143 | 8.68k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::receiver Line | Count | Source | 141 | 4.86k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 4.86k | Receiver(self) | 143 | 4.86k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::receiver Line | Count | Source | 141 | 16.6k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 16.6k | Receiver(self) | 143 | 16.6k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::receiver Line | Count | Source | 141 | 296k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 296k | Receiver(self) | 143 | 296k | } |
<crossbeam_channel::flavors::array::Channel<()>>::receiver Line | Count | Source | 141 | 19.7k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 19.7k | Receiver(self) | 143 | 19.7k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::receiver Line | Count | Source | 141 | 1 | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 1 | Receiver(self) | 143 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::receiver Line | Count | Source | 141 | 30.4k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 30.4k | Receiver(self) | 143 | 30.4k | } |
<crossbeam_channel::flavors::array::Channel<u8>>::receiver Line | Count | Source | 141 | 10.0k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 10.0k | Receiver(self) | 143 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::receiver Line | Count | Source | 141 | 33.0k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 33.0k | Receiver(self) | 143 | 33.0k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::receiver Line | Count | Source | 141 | 280k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 280k | Receiver(self) | 143 | 280k | } |
<crossbeam_channel::flavors::array::Channel<()>>::receiver Line | Count | Source | 141 | 14.8k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 14.8k | Receiver(self) | 143 | 14.8k | } |
<crossbeam_channel::flavors::array::Channel<()>>::receiver Line | Count | Source | 141 | 67.2k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 67.2k | Receiver(self) | 143 | 67.2k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::receiver Line | Count | Source | 141 | 15.9k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 15.9k | Receiver(self) | 143 | 15.9k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::receiver Line | Count | Source | 141 | 11.6k | pub(crate) fn receiver(&self) -> Receiver<'_, T> { | 142 | 11.6k | Receiver(self) | 143 | 11.6k | } |
|
144 | | |
145 | | /// Returns a sender handle to the channel. |
146 | 130k | pub(crate) fn sender(&self) -> Sender<'_, T> { |
147 | 130k | Sender(self) |
148 | 130k | } <crossbeam_channel::flavors::array::Channel<usize>>::sender Line | Count | Source | 146 | 20 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 20 | Sender(self) | 148 | 20 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::sender Line | Count | Source | 146 | 2.00k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 2.00k | Sender(self) | 148 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::sender Line | Count | Source | 146 | 4.44k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 4.44k | Sender(self) | 148 | 4.44k | } |
<crossbeam_channel::flavors::array::Channel<()>>::sender Line | Count | Source | 146 | 5 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 5 | Sender(self) | 148 | 5 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::sender Line | Count | Source | 146 | 1 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 1 | Sender(self) | 148 | 1 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::sender Line | Count | Source | 146 | 1 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 1 | Sender(self) | 148 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::sender Line | Count | Source | 146 | 3 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 3 | Sender(self) | 148 | 3 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::sender Line | Count | Source | 146 | 67.7k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 67.7k | Sender(self) | 148 | 67.7k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::sender Line | Count | Source | 146 | 1 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 1 | Sender(self) | 148 | 1 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::sender Line | Count | Source | 146 | 10 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 10 | Sender(self) | 148 | 10 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::sender Line | Count | Source | 146 | 1 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 1 | Sender(self) | 148 | 1 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::sender Line | Count | Source | 146 | 2.00k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 2.00k | Sender(self) | 148 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::sender Line | Count | Source | 146 | 20 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 20 | Sender(self) | 148 | 20 | } |
<crossbeam_channel::flavors::array::Channel<()>>::sender Line | Count | Source | 146 | 9.56k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 9.56k | Sender(self) | 148 | 9.56k | } |
<crossbeam_channel::flavors::array::Channel<()>>::sender Line | Count | Source | 146 | 42.0k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 42.0k | Sender(self) | 148 | 42.0k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::sender Line | Count | Source | 146 | 20 | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 20 | Sender(self) | 148 | 20 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::sender Line | Count | Source | 146 | 3.00k | pub(crate) fn sender(&self) -> Sender<'_, T> { | 147 | 3.00k | Sender(self) | 148 | 3.00k | } |
|
149 | | |
150 | | /// Attempts to reserve a slot for sending a message. |
151 | 3.33M | fn start_send(&self, token: &mut Token) -> bool { |
152 | 3.33M | let backoff = Backoff::new(); |
153 | 3.33M | let mut tail = self.tail.load(Ordering::Relaxed); |
154 | | |
155 | 3.52M | loop { |
156 | 3.52M | // Check if the channel is disconnected. |
157 | 3.52M | if tail & self.mark_bit != 0 { |
158 | 8 | token.array.slot = ptr::null(); |
159 | 8 | token.array.stamp = 0; |
160 | 8 | return true; |
161 | 3.52M | } |
162 | 3.52M | |
163 | 3.52M | // Deconstruct the tail. |
164 | 3.52M | let index = tail & (self.mark_bit - 1); |
165 | 3.52M | let lap = tail & !(self.one_lap - 1); |
166 | 3.52M | |
167 | 3.52M | // Inspect the corresponding slot. |
168 | 3.52M | let slot = unsafe { &*self.buffer.add(index) }; |
169 | 3.52M | let stamp = slot.stamp.load(Ordering::Acquire); |
170 | 3.52M | |
171 | 3.52M | // If the tail and the stamp match, we may attempt to push. |
172 | 3.52M | if tail == stamp { |
173 | 2.88M | let new_tail = if index + 1 < self.cap { |
174 | | // Same lap, incremented index. |
175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. |
176 | 1.66M | tail + 1 |
177 | | } else { |
178 | | // One lap forward, index wraps around to zero. |
179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. |
180 | 1.21M | lap.wrapping_add(self.one_lap) |
181 | | }; |
182 | | |
183 | | // Try moving the tail. |
184 | 2.88M | match self.tail.compare_exchange_weak( |
185 | 2.88M | tail, |
186 | 2.88M | new_tail, |
187 | 2.88M | Ordering::SeqCst, |
188 | 2.88M | Ordering::Relaxed, |
189 | 2.88M | ) { |
190 | 2.88M | Ok(_) => { |
191 | | // Prepare the token for the follow-up call to `write`. |
192 | 2.81M | token.array.slot = slot as *const Slot<T> as *const u8; |
193 | 2.81M | token.array.stamp = tail + 1; |
194 | 2.81M | return true; |
195 | | } |
196 | 87.1k | Err(t) => { |
197 | 87.1k | tail = t; |
198 | 87.1k | backoff.spin(); |
199 | 87.1k | } |
200 | | } |
201 | 641k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { |
202 | 637k | atomic::fence(Ordering::SeqCst); |
203 | 637k | let head = self.head.load(Ordering::Relaxed); |
204 | 637k | |
205 | 637k | // If the head lags one lap behind the tail as well... |
206 | 637k | if head.wrapping_add(self.one_lap) == tail { |
207 | | // ...then the channel is full. |
208 | 562k | return false; |
209 | 95.7k | } |
210 | 95.7k | |
211 | 95.7k | backoff.spin(); |
212 | 95.7k | tail = self.tail.load(Ordering::Relaxed); |
213 | 4.52k | } else { |
214 | 4.52k | // Snooze because we need to wait for the stamp to get updated. |
215 | 4.52k | backoff.snooze(); |
216 | 4.52k | tail = self.tail.load(Ordering::Relaxed); |
217 | 4.52k | } |
218 | | } |
219 | 3.38M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_send <crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 10.0k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 10.0k | let backoff = Backoff::new(); | 153 | 10.0k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 10.0k | loop { | 156 | 10.0k | // Check if the channel is disconnected. | 157 | 10.0k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 10.0k | } | 162 | 10.0k | | 163 | 10.0k | // Deconstruct the tail. | 164 | 10.0k | let index = tail & (self.mark_bit - 1); | 165 | 10.0k | let lap = tail & !(self.one_lap - 1); | 166 | 10.0k | | 167 | 10.0k | // Inspect the corresponding slot. | 168 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 10.0k | | 171 | 10.0k | // If the tail and the stamp match, we may attempt to push. | 172 | 10.0k | if tail == stamp { | 173 | 10.0k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 10.0k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 10.0k | match self.tail.compare_exchange_weak( | 185 | 10.0k | tail, | 186 | 10.0k | new_tail, | 187 | 10.0k | Ordering::SeqCst, | 188 | 10.0k | Ordering::Relaxed, | 189 | 10.0k | ) { | 190 | 10.0k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 10.0k | token.array.stamp = tail + 1; | 194 | 10.0k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_send <crossbeam_channel::flavors::array::Channel<usize>>::start_send Line | Count | Source | 151 | 10.0k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 10.0k | let backoff = Backoff::new(); | 153 | 10.0k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 10.0k | loop { | 156 | 10.0k | // Check if the channel is disconnected. | 157 | 10.0k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 10.0k | } | 162 | 10.0k | | 163 | 10.0k | // Deconstruct the tail. | 164 | 10.0k | let index = tail & (self.mark_bit - 1); | 165 | 10.0k | let lap = tail & !(self.one_lap - 1); | 166 | 10.0k | | 167 | 10.0k | // Inspect the corresponding slot. | 168 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 10.0k | | 171 | 10.0k | // If the tail and the stamp match, we may attempt to push. | 172 | 10.0k | if tail == stamp { | 173 | 10.0k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 8.01k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2.01k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 10.0k | match self.tail.compare_exchange_weak( | 185 | 10.0k | tail, | 186 | 10.0k | new_tail, | 187 | 10.0k | Ordering::SeqCst, | 188 | 10.0k | Ordering::Relaxed, | 189 | 10.0k | ) { | 190 | 10.0k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 10.0k | token.array.stamp = tail + 1; | 194 | 10.0k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 396k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 396k | let backoff = Backoff::new(); | 153 | 396k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 397k | loop { | 156 | 397k | // Check if the channel is disconnected. | 157 | 397k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 397k | } | 162 | 397k | | 163 | 397k | // Deconstruct the tail. | 164 | 397k | let index = tail & (self.mark_bit - 1); | 165 | 397k | let lap = tail & !(self.one_lap - 1); | 166 | 397k | | 167 | 397k | // Inspect the corresponding slot. | 168 | 397k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 397k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 397k | | 171 | 397k | // If the tail and the stamp match, we may attempt to push. | 172 | 397k | if tail == stamp { | 173 | 397k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 397k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 397k | match self.tail.compare_exchange_weak( | 185 | 397k | tail, | 186 | 397k | new_tail, | 187 | 397k | Ordering::SeqCst, | 188 | 397k | Ordering::Relaxed, | 189 | 397k | ) { | 190 | 397k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 397k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 397k | token.array.stamp = tail + 1; | 194 | 397k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 2.87k | return false; | 209 | 425 | } | 210 | 425 | | 211 | 425 | backoff.spin(); | 212 | 425 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 400k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_send Line | Count | Source | 151 | 63.8k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 63.8k | let backoff = Backoff::new(); | 153 | 63.8k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 63.8k | loop { | 156 | 63.8k | // Check if the channel is disconnected. | 157 | 63.8k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 63.8k | } | 162 | 63.8k | | 163 | 63.8k | // Deconstruct the tail. | 164 | 63.8k | let index = tail & (self.mark_bit - 1); | 165 | 63.8k | let lap = tail & !(self.one_lap - 1); | 166 | 63.8k | | 167 | 63.8k | // Inspect the corresponding slot. | 168 | 63.8k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 63.8k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 63.8k | | 171 | 63.8k | // If the tail and the stamp match, we may attempt to push. | 172 | 63.8k | if tail == stamp { | 173 | 64.2k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 59.2k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 4.98k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 64.2k | match self.tail.compare_exchange_weak( | 185 | 64.2k | tail, | 186 | 64.2k | new_tail, | 187 | 64.2k | Ordering::SeqCst, | 188 | 64.2k | Ordering::Relaxed, | 189 | 64.2k | ) { | 190 | 64.2k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 64.3k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 64.3k | token.array.stamp = tail + 1; | 194 | 64.3k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 9 | } | 210 | 9 | | 211 | 9 | backoff.spin(); | 212 | 9 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 64.3k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Line | Count | Source | 151 | 2.00k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 2.00k | let backoff = Backoff::new(); | 153 | 2.00k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 2.00k | loop { | 156 | 2.00k | // Check if the channel is disconnected. | 157 | 2.00k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 2.00k | } | 162 | 2.00k | | 163 | 2.00k | // Deconstruct the tail. | 164 | 2.00k | let index = tail & (self.mark_bit - 1); | 165 | 2.00k | let lap = tail & !(self.one_lap - 1); | 166 | 2.00k | | 167 | 2.00k | // Inspect the corresponding slot. | 168 | 2.00k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 2.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 2.00k | | 171 | 2.00k | // If the tail and the stamp match, we may attempt to push. | 172 | 2.00k | if tail == stamp { | 173 | 2.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 1.00k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1.00k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 2.00k | match self.tail.compare_exchange_weak( | 185 | 2.00k | tail, | 186 | 2.00k | new_tail, | 187 | 2.00k | Ordering::SeqCst, | 188 | 2.00k | Ordering::Relaxed, | 189 | 2.00k | ) { | 190 | 2.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 2.00k | token.array.stamp = tail + 1; | 194 | 2.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 2.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_send <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::start_send Line | Count | Source | 151 | 1 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1 | let backoff = Backoff::new(); | 153 | 1 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1 | loop { | 156 | 1 | // Check if the channel is disconnected. | 157 | 1 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1 | } | 162 | 1 | | 163 | 1 | // Deconstruct the tail. | 164 | 1 | let index = tail & (self.mark_bit - 1); | 165 | 1 | let lap = tail & !(self.one_lap - 1); | 166 | 1 | | 167 | 1 | // Inspect the corresponding slot. | 168 | 1 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1 | | 171 | 1 | // If the tail and the stamp match, we may attempt to push. | 172 | 1 | if tail == stamp { | 173 | 1 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1 | match self.tail.compare_exchange_weak( | 185 | 1 | tail, | 186 | 1 | new_tail, | 187 | 1 | Ordering::SeqCst, | 188 | 1 | Ordering::Relaxed, | 189 | 1 | ) { | 190 | 1 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1 | token.array.stamp = tail + 1; | 194 | 1 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 23 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 23 | let backoff = Backoff::new(); | 153 | 23 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 23 | loop { | 156 | 23 | // Check if the channel is disconnected. | 157 | 23 | if tail & self.mark_bit != 0 { | 158 | 2 | token.array.slot = ptr::null(); | 159 | 2 | token.array.stamp = 0; | 160 | 2 | return true; | 161 | 21 | } | 162 | 21 | | 163 | 21 | // Deconstruct the tail. | 164 | 21 | let index = tail & (self.mark_bit - 1); | 165 | 21 | let lap = tail & !(self.one_lap - 1); | 166 | 21 | | 167 | 21 | // Inspect the corresponding slot. | 168 | 21 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 21 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 21 | | 171 | 21 | // If the tail and the stamp match, we may attempt to push. | 172 | 21 | if tail == stamp { | 173 | 13 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 13 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 13 | match self.tail.compare_exchange_weak( | 185 | 13 | tail, | 186 | 13 | new_tail, | 187 | 13 | Ordering::SeqCst, | 188 | 13 | Ordering::Relaxed, | 189 | 13 | ) { | 190 | 13 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 13 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 13 | token.array.stamp = tail + 1; | 194 | 13 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 8 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 8 | atomic::fence(Ordering::SeqCst); | 203 | 8 | let head = self.head.load(Ordering::Relaxed); | 204 | 8 | | 205 | 8 | // If the head lags one lap behind the tail as well... | 206 | 8 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 8 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 23 | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_send Line | Count | Source | 151 | 10.2k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 10.2k | let backoff = Backoff::new(); | 153 | 10.2k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 10.2k | loop { | 156 | 10.2k | // Check if the channel is disconnected. | 157 | 10.2k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 10.2k | } | 162 | 10.2k | | 163 | 10.2k | // Deconstruct the tail. | 164 | 10.2k | let index = tail & (self.mark_bit - 1); | 165 | 10.2k | let lap = tail & !(self.one_lap - 1); | 166 | 10.2k | | 167 | 10.2k | // Inspect the corresponding slot. | 168 | 10.2k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 10.2k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 10.2k | | 171 | 10.2k | // If the tail and the stamp match, we may attempt to push. | 172 | 10.2k | if tail == stamp { | 173 | 10.2k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 10.1k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 5 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 10.2k | match self.tail.compare_exchange_weak( | 185 | 10.2k | tail, | 186 | 10.2k | new_tail, | 187 | 10.2k | Ordering::SeqCst, | 188 | 10.2k | Ordering::Relaxed, | 189 | 10.2k | ) { | 190 | 10.2k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 10.2k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 10.2k | token.array.stamp = tail + 1; | 194 | 10.2k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 1 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 1 | atomic::fence(Ordering::SeqCst); | 203 | 1 | let head = self.head.load(Ordering::Relaxed); | 204 | 1 | | 205 | 1 | // If the head lags one lap behind the tail as well... | 206 | 1 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 10.2k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::start_send Line | Count | Source | 151 | 1 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1 | let backoff = Backoff::new(); | 153 | 1 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1 | loop { | 156 | 1 | // Check if the channel is disconnected. | 157 | 1 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1 | } | 162 | 1 | | 163 | 1 | // Deconstruct the tail. | 164 | 1 | let index = tail & (self.mark_bit - 1); | 165 | 1 | let lap = tail & !(self.one_lap - 1); | 166 | 1 | | 167 | 1 | // Inspect the corresponding slot. | 168 | 1 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1 | | 171 | 1 | // If the tail and the stamp match, we may attempt to push. | 172 | 1 | if tail == stamp { | 173 | 1 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1 | match self.tail.compare_exchange_weak( | 185 | 1 | tail, | 186 | 1 | new_tail, | 187 | 1 | Ordering::SeqCst, | 188 | 1 | Ordering::Relaxed, | 189 | 1 | ) { | 190 | 1 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1 | token.array.stamp = tail + 1; | 194 | 1 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 108k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 108k | let backoff = Backoff::new(); | 153 | 108k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 120k | loop { | 156 | 120k | // Check if the channel is disconnected. | 157 | 120k | if tail & self.mark_bit != 0 { | 158 | 5 | token.array.slot = ptr::null(); | 159 | 5 | token.array.stamp = 0; | 160 | 5 | return true; | 161 | 120k | } | 162 | 120k | | 163 | 120k | // Deconstruct the tail. | 164 | 120k | let index = tail & (self.mark_bit - 1); | 165 | 120k | let lap = tail & !(self.one_lap - 1); | 166 | 120k | | 167 | 120k | // Inspect the corresponding slot. | 168 | 120k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 120k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 120k | | 171 | 120k | // If the tail and the stamp match, we may attempt to push. | 172 | 120k | if tail == stamp { | 173 | 118k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 81.2k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 36.8k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 118k | match self.tail.compare_exchange_weak( | 185 | 118k | tail, | 186 | 118k | new_tail, | 187 | 118k | Ordering::SeqCst, | 188 | 118k | Ordering::Relaxed, | 189 | 118k | ) { | 190 | 118k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 110k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 110k | token.array.stamp = tail + 1; | 194 | 110k | return true; | 195 | | } | 196 | 10.0k | Err(t) => { | 197 | 10.0k | tail = t; | 198 | 10.0k | backoff.spin(); | 199 | 10.0k | } | 200 | | } | 201 | 2.05k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 963 | atomic::fence(Ordering::SeqCst); | 203 | 963 | let head = self.head.load(Ordering::Relaxed); | 204 | 963 | | 205 | 963 | // If the head lags one lap behind the tail as well... | 206 | 963 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 37 | return false; | 209 | 38 | } | 210 | 38 | | 211 | 38 | backoff.spin(); | 212 | 38 | tail = self.tail.load(Ordering::Relaxed); | 213 | 1.09k | } else { | 214 | 1.09k | // Snooze because we need to wait for the stamp to get updated. | 215 | 1.09k | backoff.snooze(); | 216 | 1.09k | tail = self.tail.load(Ordering::Relaxed); | 217 | 1.09k | } | 218 | | } | 219 | 110k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_send Line | Count | Source | 151 | 138k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 138k | let backoff = Backoff::new(); | 153 | 138k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 141k | loop { | 156 | 141k | // Check if the channel is disconnected. | 157 | 141k | if tail & self.mark_bit != 0 { | 158 | 1 | token.array.slot = ptr::null(); | 159 | 1 | token.array.stamp = 0; | 160 | 1 | return true; | 161 | 141k | } | 162 | 141k | | 163 | 141k | // Deconstruct the tail. | 164 | 141k | let index = tail & (self.mark_bit - 1); | 165 | 141k | let lap = tail & !(self.one_lap - 1); | 166 | 141k | | 167 | 141k | // Inspect the corresponding slot. | 168 | 141k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 141k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 141k | | 171 | 141k | // If the tail and the stamp match, we may attempt to push. | 172 | 141k | if tail == stamp { | 173 | 128k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 28.4k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 100k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 128k | match self.tail.compare_exchange_weak( | 185 | 128k | tail, | 186 | 128k | new_tail, | 187 | 128k | Ordering::SeqCst, | 188 | 128k | Ordering::Relaxed, | 189 | 128k | ) { | 190 | 128k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 129k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 129k | token.array.stamp = tail + 1; | 194 | 129k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 12.7k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 12.7k | atomic::fence(Ordering::SeqCst); | 203 | 12.7k | let head = self.head.load(Ordering::Relaxed); | 204 | 12.7k | | 205 | 12.7k | // If the head lags one lap behind the tail as well... | 206 | 12.7k | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 10.7k | return false; | 209 | 2.49k | } | 210 | 2.49k | | 211 | 2.49k | backoff.spin(); | 212 | 2.49k | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 140k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::start_send Line | Count | Source | 151 | 331k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 331k | let backoff = Backoff::new(); | 153 | 331k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 373k | loop { | 156 | 373k | // Check if the channel is disconnected. | 157 | 373k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 373k | } | 162 | 373k | | 163 | 373k | // Deconstruct the tail. | 164 | 373k | let index = tail & (self.mark_bit - 1); | 165 | 373k | let lap = tail & !(self.one_lap - 1); | 166 | 373k | | 167 | 373k | // Inspect the corresponding slot. | 168 | 373k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 373k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 373k | | 171 | 373k | // If the tail and the stamp match, we may attempt to push. | 172 | 373k | if tail == stamp { | 173 | 345k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 174k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 170k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 345k | match self.tail.compare_exchange_weak( | 185 | 345k | tail, | 186 | 345k | new_tail, | 187 | 345k | Ordering::SeqCst, | 188 | 345k | Ordering::Relaxed, | 189 | 345k | ) { | 190 | 345k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 328k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 328k | token.array.stamp = tail + 1; | 194 | 328k | return true; | 195 | | } | 196 | 21.8k | Err(t) => { | 197 | 21.8k | tail = t; | 198 | 21.8k | backoff.spin(); | 199 | 21.8k | } | 200 | | } | 201 | 28.1k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 26.4k | atomic::fence(Ordering::SeqCst); | 203 | 26.4k | let head = self.head.load(Ordering::Relaxed); | 204 | 26.4k | | 205 | 26.4k | // If the head lags one lap behind the tail as well... | 206 | 26.4k | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 12.7k | return false; | 209 | 18.1k | } | 210 | 18.1k | | 211 | 18.1k | backoff.spin(); | 212 | 18.1k | tail = self.tail.load(Ordering::Relaxed); | 213 | 1.62k | } else { | 214 | 1.62k | // Snooze because we need to wait for the stamp to get updated. | 215 | 1.62k | backoff.snooze(); | 216 | 1.62k | tail = self.tail.load(Ordering::Relaxed); | 217 | 1.62k | } | 218 | | } | 219 | 341k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Line | Count | Source | 151 | 1.00k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1.00k | let backoff = Backoff::new(); | 153 | 1.00k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1.00k | loop { | 156 | 1.00k | // Check if the channel is disconnected. | 157 | 1.00k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1.00k | } | 162 | 1.00k | | 163 | 1.00k | // Deconstruct the tail. | 164 | 1.00k | let index = tail & (self.mark_bit - 1); | 165 | 1.00k | let lap = tail & !(self.one_lap - 1); | 166 | 1.00k | | 167 | 1.00k | // Inspect the corresponding slot. | 168 | 1.00k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1.00k | | 171 | 1.00k | // If the tail and the stamp match, we may attempt to push. | 172 | 1.00k | if tail == stamp { | 173 | 1.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1.00k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1.00k | match self.tail.compare_exchange_weak( | 185 | 1.00k | tail, | 186 | 1.00k | new_tail, | 187 | 1.00k | Ordering::SeqCst, | 188 | 1.00k | Ordering::Relaxed, | 189 | 1.00k | ) { | 190 | 1.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1.00k | token.array.stamp = tail + 1; | 194 | 1.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::start_send Line | Count | Source | 151 | 498k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 498k | let backoff = Backoff::new(); | 153 | 498k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 531k | loop { | 156 | 531k | // Check if the channel is disconnected. | 157 | 531k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 531k | } | 162 | 531k | | 163 | 531k | // Deconstruct the tail. | 164 | 531k | let index = tail & (self.mark_bit - 1); | 165 | 531k | let lap = tail & !(self.one_lap - 1); | 166 | 531k | | 167 | 531k | // Inspect the corresponding slot. | 168 | 531k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 531k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 531k | | 171 | 531k | // If the tail and the stamp match, we may attempt to push. | 172 | 531k | if tail == stamp { | 173 | 493k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 483k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 9.81k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 493k | match self.tail.compare_exchange_weak( | 185 | 493k | tail, | 186 | 493k | new_tail, | 187 | 493k | Ordering::SeqCst, | 188 | 493k | Ordering::Relaxed, | 189 | 493k | ) { | 190 | 493k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 493k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 493k | token.array.stamp = tail + 1; | 194 | 493k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 38.7k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 38.7k | atomic::fence(Ordering::SeqCst); | 203 | 38.7k | let head = self.head.load(Ordering::Relaxed); | 204 | 38.7k | | 205 | 38.7k | // If the head lags one lap behind the tail as well... | 206 | 38.7k | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 4.94k | return false; | 209 | 33.8k | } | 210 | 33.8k | | 211 | 33.8k | backoff.spin(); | 212 | 33.8k | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 498k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_send <crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 1 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1 | let backoff = Backoff::new(); | 153 | 1 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1 | loop { | 156 | 1 | // Check if the channel is disconnected. | 157 | 1 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1 | } | 162 | 1 | | 163 | 1 | // Deconstruct the tail. | 164 | 1 | let index = tail & (self.mark_bit - 1); | 165 | 1 | let lap = tail & !(self.one_lap - 1); | 166 | 1 | | 167 | 1 | // Inspect the corresponding slot. | 168 | 1 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1 | | 171 | 1 | // If the tail and the stamp match, we may attempt to push. | 172 | 1 | if tail == stamp { | 173 | 1 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1 | match self.tail.compare_exchange_weak( | 185 | 1 | tail, | 186 | 1 | new_tail, | 187 | 1 | Ordering::SeqCst, | 188 | 1 | Ordering::Relaxed, | 189 | 1 | ) { | 190 | 1 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1 | token.array.stamp = tail + 1; | 194 | 1 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_send <crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 1.18M | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1.18M | let backoff = Backoff::new(); | 153 | 1.18M | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1.28M | loop { | 156 | 1.28M | // Check if the channel is disconnected. | 157 | 1.28M | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1.28M | } | 162 | 1.28M | | 163 | 1.28M | // Deconstruct the tail. | 164 | 1.28M | let index = tail & (self.mark_bit - 1); | 165 | 1.28M | let lap = tail & !(self.one_lap - 1); | 166 | 1.28M | | 167 | 1.28M | // Inspect the corresponding slot. | 168 | 1.28M | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1.28M | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1.28M | | 171 | 1.28M | // If the tail and the stamp match, we may attempt to push. | 172 | 1.28M | if tail == stamp { | 173 | 718k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 683k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 34.9k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 718k | match self.tail.compare_exchange_weak( | 185 | 718k | tail, | 186 | 718k | new_tail, | 187 | 718k | Ordering::SeqCst, | 188 | 718k | Ordering::Relaxed, | 189 | 718k | ) { | 190 | 718k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 677k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 677k | token.array.stamp = tail + 1; | 194 | 677k | return true; | 195 | | } | 196 | 55.1k | Err(t) => { | 197 | 55.1k | tail = t; | 198 | 55.1k | backoff.spin(); | 199 | 55.1k | } | 200 | | } | 201 | 563k | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 561k | atomic::fence(Ordering::SeqCst); | 203 | 561k | let head = self.head.load(Ordering::Relaxed); | 204 | 561k | | 205 | 561k | // If the head lags one lap behind the tail as well... | 206 | 561k | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 525k | return false; | 209 | 40.0k | } | 210 | 40.0k | | 211 | 40.0k | backoff.spin(); | 212 | 40.0k | tail = self.tail.load(Ordering::Relaxed); | 213 | 1.80k | } else { | 214 | 1.80k | // Snooze because we need to wait for the stamp to get updated. | 215 | 1.80k | backoff.snooze(); | 216 | 1.80k | tail = self.tail.load(Ordering::Relaxed); | 217 | 1.80k | } | 218 | | } | 219 | 1.20M | } |
<crossbeam_channel::flavors::array::Channel<usize>>::start_send Line | Count | Source | 151 | 1.55k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 1.55k | let backoff = Backoff::new(); | 153 | 1.55k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 1.57k | loop { | 156 | 1.57k | // Check if the channel is disconnected. | 157 | 1.57k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 1.57k | } | 162 | 1.57k | | 163 | 1.57k | // Deconstruct the tail. | 164 | 1.57k | let index = tail & (self.mark_bit - 1); | 165 | 1.57k | let lap = tail & !(self.one_lap - 1); | 166 | 1.57k | | 167 | 1.57k | // Inspect the corresponding slot. | 168 | 1.57k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 1.57k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 1.57k | | 171 | 1.57k | // If the tail and the stamp match, we may attempt to push. | 172 | 1.57k | if tail == stamp { | 173 | 1.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 500 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 500 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1.00k | match self.tail.compare_exchange_weak( | 185 | 1.00k | tail, | 186 | 1.00k | new_tail, | 187 | 1.00k | Ordering::SeqCst, | 188 | 1.00k | Ordering::Relaxed, | 189 | 1.00k | ) { | 190 | 1.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1.00k | token.array.stamp = tail + 1; | 194 | 1.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 575 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 575 | atomic::fence(Ordering::SeqCst); | 203 | 575 | let head = self.head.load(Ordering::Relaxed); | 204 | 575 | | 205 | 575 | // If the head lags one lap behind the tail as well... | 206 | 575 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 559 | return false; | 209 | 16 | } | 210 | 16 | | 211 | 16 | backoff.spin(); | 212 | 16 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 1.55k | } |
<crossbeam_channel::flavors::array::Channel<u8>>::start_send Line | Count | Source | 151 | 20.0k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 20.0k | let backoff = Backoff::new(); | 153 | 20.0k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 20.0k | loop { | 156 | 20.0k | // Check if the channel is disconnected. | 157 | 20.0k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 20.0k | } | 162 | 20.0k | | 163 | 20.0k | // Deconstruct the tail. | 164 | 20.0k | let index = tail & (self.mark_bit - 1); | 165 | 20.0k | let lap = tail & !(self.one_lap - 1); | 166 | 20.0k | | 167 | 20.0k | // Inspect the corresponding slot. | 168 | 20.0k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 20.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 20.0k | | 171 | 20.0k | // If the tail and the stamp match, we may attempt to push. | 172 | 20.0k | if tail == stamp { | 173 | 20.0k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 20.0k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 20.0k | match self.tail.compare_exchange_weak( | 185 | 20.0k | tail, | 186 | 20.0k | new_tail, | 187 | 20.0k | Ordering::SeqCst, | 188 | 20.0k | Ordering::Relaxed, | 189 | 20.0k | ) { | 190 | 20.0k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 20.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 20.0k | token.array.stamp = tail + 1; | 194 | 20.0k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 20.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::start_send Line | Count | Source | 151 | 7 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 7 | let backoff = Backoff::new(); | 153 | 7 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 7 | loop { | 156 | 7 | // Check if the channel is disconnected. | 157 | 7 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 7 | } | 162 | 7 | | 163 | 7 | // Deconstruct the tail. | 164 | 7 | let index = tail & (self.mark_bit - 1); | 165 | 7 | let lap = tail & !(self.one_lap - 1); | 166 | 7 | | 167 | 7 | // Inspect the corresponding slot. | 168 | 7 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 7 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 7 | | 171 | 7 | // If the tail and the stamp match, we may attempt to push. | 172 | 7 | if tail == stamp { | 173 | 1 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 1 | match self.tail.compare_exchange_weak( | 185 | 1 | tail, | 186 | 1 | new_tail, | 187 | 1 | Ordering::SeqCst, | 188 | 1 | Ordering::Relaxed, | 189 | 1 | ) { | 190 | 1 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 1 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 1 | token.array.stamp = tail + 1; | 194 | 1 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 6 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 6 | atomic::fence(Ordering::SeqCst); | 203 | 6 | let head = self.head.load(Ordering::Relaxed); | 204 | 6 | | 205 | 6 | // If the head lags one lap behind the tail as well... | 206 | 6 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 6 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 7 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::start_send Line | Count | Source | 151 | 3 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 3 | let backoff = Backoff::new(); | 153 | 3 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 3 | loop { | 156 | 3 | // Check if the channel is disconnected. | 157 | 3 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 3 | } | 162 | 3 | | 163 | 3 | // Deconstruct the tail. | 164 | 3 | let index = tail & (self.mark_bit - 1); | 165 | 3 | let lap = tail & !(self.one_lap - 1); | 166 | 3 | | 167 | 3 | // Inspect the corresponding slot. | 168 | 3 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 3 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 3 | | 171 | 3 | // If the tail and the stamp match, we may attempt to push. | 172 | 3 | if tail == stamp { | 173 | 3 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 3 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 3 | match self.tail.compare_exchange_weak( | 185 | 3 | tail, | 186 | 3 | new_tail, | 187 | 3 | Ordering::SeqCst, | 188 | 3 | Ordering::Relaxed, | 189 | 3 | ) { | 190 | 3 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 3 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 3 | token.array.stamp = tail + 1; | 194 | 3 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 3 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::start_send Line | Count | Source | 151 | 2 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 2 | let backoff = Backoff::new(); | 153 | 2 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 2 | loop { | 156 | 2 | // Check if the channel is disconnected. | 157 | 2 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 2 | } | 162 | 2 | | 163 | 2 | // Deconstruct the tail. | 164 | 2 | let index = tail & (self.mark_bit - 1); | 165 | 2 | let lap = tail & !(self.one_lap - 1); | 166 | 2 | | 167 | 2 | // Inspect the corresponding slot. | 168 | 2 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 2 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 2 | | 171 | 2 | // If the tail and the stamp match, we may attempt to push. | 172 | 2 | if tail == stamp { | 173 | 2 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 2 | match self.tail.compare_exchange_weak( | 185 | 2 | tail, | 186 | 2 | new_tail, | 187 | 2 | Ordering::SeqCst, | 188 | 2 | Ordering::Relaxed, | 189 | 2 | ) { | 190 | 2 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 2 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 2 | token.array.stamp = tail + 1; | 194 | 2 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 2 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::start_send Line | Count | Source | 151 | 2.00k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 2.00k | let backoff = Backoff::new(); | 153 | 2.00k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 2.00k | loop { | 156 | 2.00k | // Check if the channel is disconnected. | 157 | 2.00k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 2.00k | } | 162 | 2.00k | | 163 | 2.00k | // Deconstruct the tail. | 164 | 2.00k | let index = tail & (self.mark_bit - 1); | 165 | 2.00k | let lap = tail & !(self.one_lap - 1); | 166 | 2.00k | | 167 | 2.00k | // Inspect the corresponding slot. | 168 | 2.00k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 2.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 2.00k | | 171 | 2.00k | // If the tail and the stamp match, we may attempt to push. | 172 | 2.00k | if tail == stamp { | 173 | 2.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2.00k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 2.00k | match self.tail.compare_exchange_weak( | 185 | 2.00k | tail, | 186 | 2.00k | new_tail, | 187 | 2.00k | Ordering::SeqCst, | 188 | 2.00k | Ordering::Relaxed, | 189 | 2.00k | ) { | 190 | 2.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 2.00k | token.array.stamp = tail + 1; | 194 | 2.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::start_send Line | Count | Source | 151 | 2 | fn start_send(&self, token: &mut Token) -> bool { | 152 | 2 | let backoff = Backoff::new(); | 153 | 2 | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 2 | loop { | 156 | 2 | // Check if the channel is disconnected. | 157 | 2 | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 2 | } | 162 | 2 | | 163 | 2 | // Deconstruct the tail. | 164 | 2 | let index = tail & (self.mark_bit - 1); | 165 | 2 | let lap = tail & !(self.one_lap - 1); | 166 | 2 | | 167 | 2 | // Inspect the corresponding slot. | 168 | 2 | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 2 | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 2 | | 171 | 2 | // If the tail and the stamp match, we may attempt to push. | 172 | 2 | if tail == stamp { | 173 | 2 | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2 | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 2 | match self.tail.compare_exchange_weak( | 185 | 2 | tail, | 186 | 2 | new_tail, | 187 | 2 | Ordering::SeqCst, | 188 | 2 | Ordering::Relaxed, | 189 | 2 | ) { | 190 | 2 | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 2 | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 2 | token.array.stamp = tail + 1; | 194 | 2 | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 2 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::start_send Line | Count | Source | 151 | 10.0k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 10.0k | let backoff = Backoff::new(); | 153 | 10.0k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 10.0k | loop { | 156 | 10.0k | // Check if the channel is disconnected. | 157 | 10.0k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 10.0k | } | 162 | 10.0k | | 163 | 10.0k | // Deconstruct the tail. | 164 | 10.0k | let index = tail & (self.mark_bit - 1); | 165 | 10.0k | let lap = tail & !(self.one_lap - 1); | 166 | 10.0k | | 167 | 10.0k | // Inspect the corresponding slot. | 168 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 10.0k | | 171 | 10.0k | // If the tail and the stamp match, we may attempt to push. | 172 | 10.0k | if tail == stamp { | 173 | 10.0k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 8.01k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2.01k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 10.0k | match self.tail.compare_exchange_weak( | 185 | 10.0k | tail, | 186 | 10.0k | new_tail, | 187 | 10.0k | Ordering::SeqCst, | 188 | 10.0k | Ordering::Relaxed, | 189 | 10.0k | ) { | 190 | 10.0k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 10.0k | token.array.stamp = tail + 1; | 194 | 10.0k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Line | Count | Source | 151 | 2.00k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 2.00k | let backoff = Backoff::new(); | 153 | 2.00k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 2.00k | loop { | 156 | 2.00k | // Check if the channel is disconnected. | 157 | 2.00k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 2.00k | } | 162 | 2.00k | | 163 | 2.00k | // Deconstruct the tail. | 164 | 2.00k | let index = tail & (self.mark_bit - 1); | 165 | 2.00k | let lap = tail & !(self.one_lap - 1); | 166 | 2.00k | | 167 | 2.00k | // Inspect the corresponding slot. | 168 | 2.00k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 2.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 2.00k | | 171 | 2.00k | // If the tail and the stamp match, we may attempt to push. | 172 | 2.00k | if tail == stamp { | 173 | 2.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 1.00k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1.00k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 2.00k | match self.tail.compare_exchange_weak( | 185 | 2.00k | tail, | 186 | 2.00k | new_tail, | 187 | 2.00k | Ordering::SeqCst, | 188 | 2.00k | Ordering::Relaxed, | 189 | 2.00k | ) { | 190 | 2.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 2.00k | token.array.stamp = tail + 1; | 194 | 2.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_send Line | Count | Source | 151 | 392k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 392k | let backoff = Backoff::new(); | 153 | 392k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 392k | loop { | 156 | 392k | // Check if the channel is disconnected. | 157 | 392k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 392k | } | 162 | 392k | | 163 | 392k | // Deconstruct the tail. | 164 | 392k | let index = tail & (self.mark_bit - 1); | 165 | 392k | let lap = tail & !(self.one_lap - 1); | 166 | 392k | | 167 | 392k | // Inspect the corresponding slot. | 168 | 392k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 392k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 392k | | 171 | 392k | // If the tail and the stamp match, we may attempt to push. | 172 | 392k | if tail == stamp { | 173 | 394k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 0 | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 394k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 394k | match self.tail.compare_exchange_weak( | 185 | 394k | tail, | 186 | 394k | new_tail, | 187 | 394k | Ordering::SeqCst, | 188 | 394k | Ordering::Relaxed, | 189 | 394k | ) { | 190 | 394k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 396k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 396k | token.array.stamp = tail + 1; | 194 | 396k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 4.38k | return false; | 209 | 728 | } | 210 | 728 | | 211 | 728 | backoff.spin(); | 212 | 728 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 401k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_send Line | Count | Source | 151 | 68.2k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 68.2k | let backoff = Backoff::new(); | 153 | 68.2k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 68.2k | loop { | 156 | 68.2k | // Check if the channel is disconnected. | 157 | 68.2k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 68.2k | } | 162 | 68.2k | | 163 | 68.2k | // Deconstruct the tail. | 164 | 68.2k | let index = tail & (self.mark_bit - 1); | 165 | 68.2k | let lap = tail & !(self.one_lap - 1); | 166 | 68.2k | | 167 | 68.2k | // Inspect the corresponding slot. | 168 | 68.2k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 68.2k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 68.2k | | 171 | 68.2k | // If the tail and the stamp match, we may attempt to push. | 172 | 68.2k | if tail == stamp { | 173 | 68.7k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 63.7k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 5.03k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 68.7k | match self.tail.compare_exchange_weak( | 185 | 68.7k | tail, | 186 | 68.7k | new_tail, | 187 | 68.7k | Ordering::SeqCst, | 188 | 68.7k | Ordering::Relaxed, | 189 | 68.7k | ) { | 190 | 68.7k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 69.3k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 69.3k | token.array.stamp = tail + 1; | 194 | 69.3k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 69.3k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_send <crossbeam_channel::flavors::array::Channel<usize>>::start_send Line | Count | Source | 151 | 10.0k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 10.0k | let backoff = Backoff::new(); | 153 | 10.0k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 10.0k | loop { | 156 | 10.0k | // Check if the channel is disconnected. | 157 | 10.0k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 10.0k | } | 162 | 10.0k | | 163 | 10.0k | // Deconstruct the tail. | 164 | 10.0k | let index = tail & (self.mark_bit - 1); | 165 | 10.0k | let lap = tail & !(self.one_lap - 1); | 166 | 10.0k | | 167 | 10.0k | // Inspect the corresponding slot. | 168 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 10.0k | | 171 | 10.0k | // If the tail and the stamp match, we may attempt to push. | 172 | 10.0k | if tail == stamp { | 173 | 10.0k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 8.01k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 2.01k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 10.0k | match self.tail.compare_exchange_weak( | 185 | 10.0k | tail, | 186 | 10.0k | new_tail, | 187 | 10.0k | Ordering::SeqCst, | 188 | 10.0k | Ordering::Relaxed, | 189 | 10.0k | ) { | 190 | 10.0k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 10.0k | token.array.stamp = tail + 1; | 194 | 10.0k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_send Line | Count | Source | 151 | 3.00k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 3.00k | let backoff = Backoff::new(); | 153 | 3.00k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 3.00k | loop { | 156 | 3.00k | // Check if the channel is disconnected. | 157 | 3.00k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 3.00k | } | 162 | 3.00k | | 163 | 3.00k | // Deconstruct the tail. | 164 | 3.00k | let index = tail & (self.mark_bit - 1); | 165 | 3.00k | let lap = tail & !(self.one_lap - 1); | 166 | 3.00k | | 167 | 3.00k | // Inspect the corresponding slot. | 168 | 3.00k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 3.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 3.00k | | 171 | 3.00k | // If the tail and the stamp match, we may attempt to push. | 172 | 3.00k | if tail == stamp { | 173 | 3.00k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 2.00k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 1.00k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 3.00k | match self.tail.compare_exchange_weak( | 185 | 3.00k | tail, | 186 | 3.00k | new_tail, | 187 | 3.00k | Ordering::SeqCst, | 188 | 3.00k | Ordering::Relaxed, | 189 | 3.00k | ) { | 190 | 3.00k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 3.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 3.00k | token.array.stamp = tail + 1; | 194 | 3.00k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 0 | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 0 | atomic::fence(Ordering::SeqCst); | 203 | 0 | let head = self.head.load(Ordering::Relaxed); | 204 | 0 |
| 205 | 0 | // If the head lags one lap behind the tail as well... | 206 | 0 | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 0 | } | 210 | 0 |
| 211 | 0 | backoff.spin(); | 212 | 0 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_send Line | Count | Source | 151 | 71.2k | fn start_send(&self, token: &mut Token) -> bool { | 152 | 71.2k | let backoff = Backoff::new(); | 153 | 71.2k | let mut tail = self.tail.load(Ordering::Relaxed); | 154 | | | 155 | 71.2k | loop { | 156 | 71.2k | // Check if the channel is disconnected. | 157 | 71.2k | if tail & self.mark_bit != 0 { | 158 | 0 | token.array.slot = ptr::null(); | 159 | 0 | token.array.stamp = 0; | 160 | 0 | return true; | 161 | 71.2k | } | 162 | 71.2k | | 163 | 71.2k | // Deconstruct the tail. | 164 | 71.2k | let index = tail & (self.mark_bit - 1); | 165 | 71.2k | let lap = tail & !(self.one_lap - 1); | 166 | 71.2k | | 167 | 71.2k | // Inspect the corresponding slot. | 168 | 71.2k | let slot = unsafe { &*self.buffer.add(index) }; | 169 | 71.2k | let stamp = slot.stamp.load(Ordering::Acquire); | 170 | 71.2k | | 171 | 71.2k | // If the tail and the stamp match, we may attempt to push. | 172 | 71.2k | if tail == stamp { | 173 | 71.8k | let new_tail = if index + 1 < self.cap { | 174 | | // Same lap, incremented index. | 175 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 176 | 29.6k | tail + 1 | 177 | | } else { | 178 | | // One lap forward, index wraps around to zero. | 179 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 180 | 42.2k | lap.wrapping_add(self.one_lap) | 181 | | }; | 182 | | | 183 | | // Try moving the tail. | 184 | 71.8k | match self.tail.compare_exchange_weak( | 185 | 71.8k | tail, | 186 | 71.8k | new_tail, | 187 | 71.8k | Ordering::SeqCst, | 188 | 71.8k | Ordering::Relaxed, | 189 | 71.8k | ) { | 190 | 71.8k | Ok(_) => { | 191 | | // Prepare the token for the follow-up call to `write`. | 192 | 71.8k | token.array.slot = slot as *const Slot<T> as *const u8; | 193 | 71.8k | token.array.stamp = tail + 1; | 194 | 71.8k | return true; | 195 | | } | 196 | 0 | Err(t) => { | 197 | 0 | tail = t; | 198 | 0 | backoff.spin(); | 199 | 0 | } | 200 | | } | 201 | 18.4E | } else if stamp.wrapping_add(self.one_lap) == tail + 1 { | 202 | 18.4E | atomic::fence(Ordering::SeqCst); | 203 | 18.4E | let head = self.head.load(Ordering::Relaxed); | 204 | 18.4E | | 205 | 18.4E | // If the head lags one lap behind the tail as well... | 206 | 18.4E | if head.wrapping_add(self.one_lap) == tail { | 207 | | // ...then the channel is full. | 208 | 0 | return false; | 209 | 30 | } | 210 | 30 | | 211 | 30 | backoff.spin(); | 212 | 30 | tail = self.tail.load(Ordering::Relaxed); | 213 | 0 | } else { | 214 | 0 | // Snooze because we need to wait for the stamp to get updated. | 215 | 0 | backoff.snooze(); | 216 | 0 | tail = self.tail.load(Ordering::Relaxed); | 217 | 0 | } | 218 | | } | 219 | 71.8k | } |
|
220 | | |
221 | | /// Writes a message into the channel. |
222 | 2.80M | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { |
223 | 2.80M | // If there is no slot, the channel is disconnected. |
224 | 2.80M | if token.array.slot.is_null() { |
225 | 8 | return Err(msg); |
226 | 2.80M | } |
227 | 2.80M | |
228 | 2.80M | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); |
229 | 2.80M | |
230 | 2.80M | // Write the message into the slot and update the stamp. |
231 | 2.80M | slot.msg.get().write(MaybeUninit::new(msg)); |
232 | 2.80M | slot.stamp.store(token.array.stamp, Ordering::Release); |
233 | 2.80M | |
234 | 2.80M | // Wake a sleeping receiver. |
235 | 2.80M | self.receivers.notify(); |
236 | 2.80M | Ok(()) |
237 | 2.80M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::write <crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 10.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 10.0k | // If there is no slot, the channel is disconnected. | 224 | 10.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 10.0k | } | 227 | 10.0k | | 228 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 10.0k | | 230 | 10.0k | // Write the message into the slot and update the stamp. | 231 | 10.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 10.0k | | 234 | 10.0k | // Wake a sleeping receiver. | 235 | 10.0k | self.receivers.notify(); | 236 | 10.0k | Ok(()) | 237 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::write <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Line | Count | Source | 222 | 2.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 2.00k | // If there is no slot, the channel is disconnected. | 224 | 2.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 2.00k | } | 227 | 2.00k | | 228 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 2.00k | | 230 | 2.00k | // Write the message into the slot and update the stamp. | 231 | 2.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 2.00k | | 234 | 2.00k | // Wake a sleeping receiver. | 235 | 2.00k | self.receivers.notify(); | 236 | 2.00k | Ok(()) | 237 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::write Line | Count | Source | 222 | 10.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 10.0k | // If there is no slot, the channel is disconnected. | 224 | 10.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 10.0k | } | 227 | 10.0k | | 228 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 10.0k | | 230 | 10.0k | // Write the message into the slot and update the stamp. | 231 | 10.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 10.0k | | 234 | 10.0k | // Wake a sleeping receiver. | 235 | 10.0k | self.receivers.notify(); | 236 | 10.0k | Ok(()) | 237 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 396k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 396k | // If there is no slot, the channel is disconnected. | 224 | 396k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 396k | } | 227 | 396k | | 228 | 396k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 396k | | 230 | 396k | // Write the message into the slot and update the stamp. | 231 | 396k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 396k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 396k | | 234 | 396k | // Wake a sleeping receiver. | 235 | 396k | self.receivers.notify(); | 236 | 396k | Ok(()) | 237 | 396k | } |
<crossbeam_channel::flavors::array::Channel<()>>::write Line | Count | Source | 222 | 64.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 64.0k | // If there is no slot, the channel is disconnected. | 224 | 64.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 64.0k | } | 227 | 64.0k | | 228 | 64.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 64.0k | | 230 | 64.0k | // Write the message into the slot and update the stamp. | 231 | 64.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 64.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 64.0k | | 234 | 64.0k | // Wake a sleeping receiver. | 235 | 64.0k | self.receivers.notify(); | 236 | 64.0k | Ok(()) | 237 | 64.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::write <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::write Line | Count | Source | 222 | 1 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1 | // If there is no slot, the channel is disconnected. | 224 | 1 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1 | } | 227 | 1 | | 228 | 1 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1 | | 230 | 1 | // Write the message into the slot and update the stamp. | 231 | 1 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1 | | 234 | 1 | // Wake a sleeping receiver. | 235 | 1 | self.receivers.notify(); | 236 | 1 | Ok(()) | 237 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 15 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 15 | // If there is no slot, the channel is disconnected. | 224 | 15 | if token.array.slot.is_null() { | 225 | 2 | return Err(msg); | 226 | 13 | } | 227 | 13 | | 228 | 13 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 13 | | 230 | 13 | // Write the message into the slot and update the stamp. | 231 | 13 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 13 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 13 | | 234 | 13 | // Wake a sleeping receiver. | 235 | 13 | self.receivers.notify(); | 236 | 13 | Ok(()) | 237 | 15 | } |
<crossbeam_channel::flavors::array::Channel<()>>::write Line | Count | Source | 222 | 10.2k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 10.2k | // If there is no slot, the channel is disconnected. | 224 | 10.2k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 10.2k | } | 227 | 10.2k | | 228 | 10.2k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 10.2k | | 230 | 10.2k | // Write the message into the slot and update the stamp. | 231 | 10.2k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 10.2k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 10.2k | | 234 | 10.2k | // Wake a sleeping receiver. | 235 | 10.2k | self.receivers.notify(); | 236 | 10.2k | Ok(()) | 237 | 10.2k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::write Line | Count | Source | 222 | 1 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1 | // If there is no slot, the channel is disconnected. | 224 | 1 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1 | } | 227 | 1 | | 228 | 1 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1 | | 230 | 1 | // Write the message into the slot and update the stamp. | 231 | 1 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1 | | 234 | 1 | // Wake a sleeping receiver. | 235 | 1 | self.receivers.notify(); | 236 | 1 | Ok(()) | 237 | 1 | } |
<crossbeam_channel::flavors::array::Channel<()>>::write Line | Count | Source | 222 | 129k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 129k | // If there is no slot, the channel is disconnected. | 224 | 129k | if token.array.slot.is_null() { | 225 | 1 | return Err(msg); | 226 | 129k | } | 227 | 129k | | 228 | 129k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 129k | | 230 | 129k | // Write the message into the slot and update the stamp. | 231 | 129k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 129k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 129k | | 234 | 129k | // Wake a sleeping receiver. | 235 | 129k | self.receivers.notify(); | 236 | 129k | Ok(()) | 237 | 129k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::write Line | Count | Source | 222 | 325k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 325k | // If there is no slot, the channel is disconnected. | 224 | 325k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 325k | } | 227 | 325k | | 228 | 325k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 325k | | 230 | 325k | // Write the message into the slot and update the stamp. | 231 | 325k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 325k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 325k | | 234 | 325k | // Wake a sleeping receiver. | 235 | 325k | self.receivers.notify(); | 236 | 325k | Ok(()) | 237 | 325k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Line | Count | Source | 222 | 1.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1.00k | // If there is no slot, the channel is disconnected. | 224 | 1.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1.00k | } | 227 | 1.00k | | 228 | 1.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1.00k | | 230 | 1.00k | // Write the message into the slot and update the stamp. | 231 | 1.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1.00k | | 234 | 1.00k | // Wake a sleeping receiver. | 235 | 1.00k | self.receivers.notify(); | 236 | 1.00k | Ok(()) | 237 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::write Line | Count | Source | 222 | 493k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 493k | // If there is no slot, the channel is disconnected. | 224 | 493k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 493k | } | 227 | 493k | | 228 | 493k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 493k | | 230 | 493k | // Write the message into the slot and update the stamp. | 231 | 493k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 493k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 493k | | 234 | 493k | // Wake a sleeping receiver. | 235 | 493k | self.receivers.notify(); | 236 | 493k | Ok(()) | 237 | 493k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 110k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 110k | // If there is no slot, the channel is disconnected. | 224 | 110k | if token.array.slot.is_null() { | 225 | 5 | return Err(msg); | 226 | 110k | } | 227 | 110k | | 228 | 110k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 110k | | 230 | 110k | // Write the message into the slot and update the stamp. | 231 | 110k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 110k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 110k | | 234 | 110k | // Wake a sleeping receiver. | 235 | 110k | self.receivers.notify(); | 236 | 110k | Ok(()) | 237 | 110k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::write <crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 1 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1 | // If there is no slot, the channel is disconnected. | 224 | 1 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1 | } | 227 | 1 | | 228 | 1 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1 | | 230 | 1 | // Write the message into the slot and update the stamp. | 231 | 1 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1 | | 234 | 1 | // Wake a sleeping receiver. | 235 | 1 | self.receivers.notify(); | 236 | 1 | Ok(()) | 237 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::write <crossbeam_channel::flavors::array::Channel<usize>>::write Line | Count | Source | 222 | 1.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1.00k | // If there is no slot, the channel is disconnected. | 224 | 1.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1.00k | } | 227 | 1.00k | | 228 | 1.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1.00k | | 230 | 1.00k | // Write the message into the slot and update the stamp. | 231 | 1.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1.00k | | 234 | 1.00k | // Wake a sleeping receiver. | 235 | 1.00k | self.receivers.notify(); | 236 | 1.00k | Ok(()) | 237 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<bool>>::write Line | Count | Source | 222 | 2.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 2.00k | // If there is no slot, the channel is disconnected. | 224 | 2.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 2.00k | } | 227 | 2.00k | | 228 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 2.00k | | 230 | 2.00k | // Write the message into the slot and update the stamp. | 231 | 2.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 2.00k | | 234 | 2.00k | // Wake a sleeping receiver. | 235 | 2.00k | self.receivers.notify(); | 236 | 2.00k | Ok(()) | 237 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::write Line | Count | Source | 222 | 2 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 2 | // If there is no slot, the channel is disconnected. | 224 | 2 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 2 | } | 227 | 2 | | 228 | 2 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 2 | | 230 | 2 | // Write the message into the slot and update the stamp. | 231 | 2 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 2 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 2 | | 234 | 2 | // Wake a sleeping receiver. | 235 | 2 | self.receivers.notify(); | 236 | 2 | Ok(()) | 237 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 671k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 671k | // If there is no slot, the channel is disconnected. | 224 | 671k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 671k | } | 227 | 671k | | 228 | 671k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 671k | | 230 | 671k | // Write the message into the slot and update the stamp. | 231 | 671k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 671k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 671k | | 234 | 671k | // Wake a sleeping receiver. | 235 | 671k | self.receivers.notify(); | 236 | 671k | Ok(()) | 237 | 671k | } |
<crossbeam_channel::flavors::array::Channel<u8>>::write Line | Count | Source | 222 | 20.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 20.0k | // If there is no slot, the channel is disconnected. | 224 | 20.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 20.0k | } | 227 | 20.0k | | 228 | 20.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 20.0k | | 230 | 20.0k | // Write the message into the slot and update the stamp. | 231 | 20.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 20.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 20.0k | | 234 | 20.0k | // Wake a sleeping receiver. | 235 | 20.0k | self.receivers.notify(); | 236 | 20.0k | Ok(()) | 237 | 20.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::write Line | Count | Source | 222 | 1 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 1 | // If there is no slot, the channel is disconnected. | 224 | 1 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 1 | } | 227 | 1 | | 228 | 1 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 1 | | 230 | 1 | // Write the message into the slot and update the stamp. | 231 | 1 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 1 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 1 | | 234 | 1 | // Wake a sleeping receiver. | 235 | 1 | self.receivers.notify(); | 236 | 1 | Ok(()) | 237 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::write Line | Count | Source | 222 | 3 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 3 | // If there is no slot, the channel is disconnected. | 224 | 3 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 3 | } | 227 | 3 | | 228 | 3 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 3 | | 230 | 3 | // Write the message into the slot and update the stamp. | 231 | 3 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 3 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 3 | | 234 | 3 | // Wake a sleeping receiver. | 235 | 3 | self.receivers.notify(); | 236 | 3 | Ok(()) | 237 | 3 | } |
<crossbeam_channel::flavors::array::Channel<i64>>::write Line | Count | Source | 222 | 2 | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 2 | // If there is no slot, the channel is disconnected. | 224 | 2 | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 2 | } | 227 | 2 | | 228 | 2 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 2 | | 230 | 2 | // Write the message into the slot and update the stamp. | 231 | 2 | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 2 | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 2 | | 234 | 2 | // Wake a sleeping receiver. | 235 | 2 | self.receivers.notify(); | 236 | 2 | Ok(()) | 237 | 2 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::write Line | Count | Source | 222 | 10.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 10.0k | // If there is no slot, the channel is disconnected. | 224 | 10.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 10.0k | } | 227 | 10.0k | | 228 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 10.0k | | 230 | 10.0k | // Write the message into the slot and update the stamp. | 231 | 10.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 10.0k | | 234 | 10.0k | // Wake a sleeping receiver. | 235 | 10.0k | self.receivers.notify(); | 236 | 10.0k | Ok(()) | 237 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Line | Count | Source | 222 | 2.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 2.00k | // If there is no slot, the channel is disconnected. | 224 | 2.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 2.00k | } | 227 | 2.00k | | 228 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 2.00k | | 230 | 2.00k | // Write the message into the slot and update the stamp. | 231 | 2.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 2.00k | | 234 | 2.00k | // Wake a sleeping receiver. | 235 | 2.00k | self.receivers.notify(); | 236 | 2.00k | Ok(()) | 237 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::write Line | Count | Source | 222 | 392k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 392k | // If there is no slot, the channel is disconnected. | 224 | 392k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 392k | } | 227 | 392k | | 228 | 392k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 392k | | 230 | 392k | // Write the message into the slot and update the stamp. | 231 | 392k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 392k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 392k | | 234 | 392k | // Wake a sleeping receiver. | 235 | 392k | self.receivers.notify(); | 236 | 392k | Ok(()) | 237 | 392k | } |
<crossbeam_channel::flavors::array::Channel<()>>::write Line | Count | Source | 222 | 68.5k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 68.5k | // If there is no slot, the channel is disconnected. | 224 | 68.5k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 68.5k | } | 227 | 68.5k | | 228 | 68.5k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 68.5k | | 230 | 68.5k | // Write the message into the slot and update the stamp. | 231 | 68.5k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 68.5k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 68.5k | | 234 | 68.5k | // Wake a sleeping receiver. | 235 | 68.5k | self.receivers.notify(); | 236 | 68.5k | Ok(()) | 237 | 68.5k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::write Line | Count | Source | 222 | 10.0k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 10.0k | // If there is no slot, the channel is disconnected. | 224 | 10.0k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 10.0k | } | 227 | 10.0k | | 228 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 10.0k | | 230 | 10.0k | // Write the message into the slot and update the stamp. | 231 | 10.0k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 10.0k | | 234 | 10.0k | // Wake a sleeping receiver. | 235 | 10.0k | self.receivers.notify(); | 236 | 10.0k | Ok(()) | 237 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::write Line | Count | Source | 222 | 3.00k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 3.00k | // If there is no slot, the channel is disconnected. | 224 | 3.00k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 3.00k | } | 227 | 3.00k | | 228 | 3.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 3.00k | | 230 | 3.00k | // Write the message into the slot and update the stamp. | 231 | 3.00k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 3.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 3.00k | | 234 | 3.00k | // Wake a sleeping receiver. | 235 | 3.00k | self.receivers.notify(); | 236 | 3.00k | Ok(()) | 237 | 3.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::write <crossbeam_channel::flavors::array::Channel<()>>::write Line | Count | Source | 222 | 71.4k | pub(crate) unsafe fn write(&self, token: &mut Token, msg: T) -> Result<(), T> { | 223 | 71.4k | // If there is no slot, the channel is disconnected. | 224 | 71.4k | if token.array.slot.is_null() { | 225 | 0 | return Err(msg); | 226 | 71.4k | } | 227 | 71.4k | | 228 | 71.4k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 229 | 71.4k | | 230 | 71.4k | // Write the message into the slot and update the stamp. | 231 | 71.4k | slot.msg.get().write(MaybeUninit::new(msg)); | 232 | 71.4k | slot.stamp.store(token.array.stamp, Ordering::Release); | 233 | 71.4k | | 234 | 71.4k | // Wake a sleeping receiver. | 235 | 71.4k | self.receivers.notify(); | 236 | 71.4k | Ok(()) | 237 | 71.4k | } |
|
238 | | |
239 | | /// Attempts to reserve a slot for receiving a message. |
240 | 4.50M | fn start_recv(&self, token: &mut Token) -> bool { |
241 | 4.50M | let backoff = Backoff::new(); |
242 | 4.50M | let mut head = self.head.load(Ordering::Relaxed); |
243 | | |
244 | 4.80M | loop { |
245 | 4.80M | // Deconstruct the head. |
246 | 4.80M | let index = head & (self.mark_bit - 1); |
247 | 4.80M | let lap = head & !(self.one_lap - 1); |
248 | 4.80M | |
249 | 4.80M | // Inspect the corresponding slot. |
250 | 4.80M | let slot = unsafe { &*self.buffer.add(index) }; |
251 | 4.80M | let stamp = slot.stamp.load(Ordering::Acquire); |
252 | 4.80M | |
253 | 4.80M | // If the the stamp is ahead of the head by 1, we may attempt to pop. |
254 | 4.80M | if head + 1 == stamp { |
255 | 2.85M | let new = if index + 1 < self.cap { |
256 | | // Same lap, incremented index. |
257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. |
258 | 1.60M | head + 1 |
259 | | } else { |
260 | | // One lap forward, index wraps around to zero. |
261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. |
262 | 1.25M | lap.wrapping_add(self.one_lap) |
263 | | }; |
264 | | |
265 | | // Try moving the head. |
266 | 2.85M | match self.head.compare_exchange_weak( |
267 | 2.85M | head, |
268 | 2.85M | new, |
269 | 2.85M | Ordering::SeqCst, |
270 | 2.85M | Ordering::Relaxed, |
271 | 2.85M | ) { |
272 | 2.85M | Ok(_) => { |
273 | | // Prepare the token for the follow-up call to `read`. |
274 | 2.72M | token.array.slot = slot as *const Slot<T> as *const u8; |
275 | 2.72M | token.array.stamp = head.wrapping_add(self.one_lap); |
276 | 2.72M | return true; |
277 | | } |
278 | 134k | Err(h) => { |
279 | 134k | head = h; |
280 | 134k | backoff.spin(); |
281 | 134k | } |
282 | | } |
283 | 1.94M | } else if stamp == head { |
284 | 1.92M | atomic::fence(Ordering::SeqCst); |
285 | 1.92M | let tail = self.tail.load(Ordering::Relaxed); |
286 | 1.92M | |
287 | 1.92M | // If the tail equals the head, that means the channel is empty. |
288 | 1.92M | if (tail & !self.mark_bit) == head { |
289 | | // If the channel is disconnected... |
290 | 1.78M | if tail & self.mark_bit != 0 { |
291 | | // ...then receive an error. |
292 | 1.43k | token.array.slot = ptr::null(); |
293 | 1.43k | token.array.stamp = 0; |
294 | 1.43k | return true; |
295 | | } else { |
296 | | // Otherwise, the receive operation is not ready. |
297 | 1.87M | return false; |
298 | | } |
299 | 148k | } |
300 | 148k | |
301 | 148k | backoff.spin(); |
302 | 148k | head = self.head.load(Ordering::Relaxed); |
303 | 16.4k | } else { |
304 | 16.4k | // Snooze because we need to wait for the stamp to get updated. |
305 | 16.4k | backoff.snooze(); |
306 | 16.4k | head = self.head.load(Ordering::Relaxed); |
307 | 16.4k | } |
308 | | } |
309 | 4.60M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_recv <crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 83.0k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 83.0k | let backoff = Backoff::new(); | 242 | 83.0k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 83.3k | loop { | 245 | 83.3k | // Deconstruct the head. | 246 | 83.3k | let index = head & (self.mark_bit - 1); | 247 | 83.3k | let lap = head & !(self.one_lap - 1); | 248 | 83.3k | | 249 | 83.3k | // Inspect the corresponding slot. | 250 | 83.3k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 83.3k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 83.3k | | 253 | 83.3k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 83.3k | if head + 1 == stamp { | 255 | 10.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 10.0k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.0k | match self.head.compare_exchange_weak( | 267 | 10.0k | head, | 268 | 10.0k | new, | 269 | 10.0k | Ordering::SeqCst, | 270 | 10.0k | Ordering::Relaxed, | 271 | 10.0k | ) { | 272 | 10.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 73.3k | } else if stamp == head { | 284 | 73.3k | atomic::fence(Ordering::SeqCst); | 285 | 73.3k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 73.3k | | 287 | 73.3k | // If the tail equals the head, that means the channel is empty. | 288 | 73.3k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 73.0k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 73.0k | return false; | 298 | | } | 299 | 262 | } | 300 | 262 | | 301 | 262 | backoff.spin(); | 302 | 262 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 83.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Line | Count | Source | 240 | 15.6k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 15.6k | let backoff = Backoff::new(); | 242 | 15.6k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 15.8k | loop { | 245 | 15.8k | // Deconstruct the head. | 246 | 15.8k | let index = head & (self.mark_bit - 1); | 247 | 15.8k | let lap = head & !(self.one_lap - 1); | 248 | 15.8k | | 249 | 15.8k | // Inspect the corresponding slot. | 250 | 15.8k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 15.8k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 15.8k | | 253 | 15.8k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 15.8k | if head + 1 == stamp { | 255 | 10.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 8.01k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2.01k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.0k | match self.head.compare_exchange_weak( | 267 | 10.0k | head, | 268 | 10.0k | new, | 269 | 10.0k | Ordering::SeqCst, | 270 | 10.0k | Ordering::Relaxed, | 271 | 10.0k | ) { | 272 | 10.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 5.83k | } else if stamp == head { | 284 | 5.83k | atomic::fence(Ordering::SeqCst); | 285 | 5.83k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 5.83k | | 287 | 5.83k | // If the tail equals the head, that means the channel is empty. | 288 | 5.83k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 5.62k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 5.62k | return false; | 298 | | } | 299 | 208 | } | 300 | 208 | | 301 | 208 | backoff.spin(); | 302 | 208 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 15.6k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 672k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 672k | let backoff = Backoff::new(); | 242 | 672k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 681k | loop { | 245 | 681k | // Deconstruct the head. | 246 | 681k | let index = head & (self.mark_bit - 1); | 247 | 681k | let lap = head & !(self.one_lap - 1); | 248 | 681k | | 249 | 681k | // Inspect the corresponding slot. | 250 | 681k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 681k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 681k | | 253 | 681k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 681k | if head + 1 == stamp { | 255 | 402k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 402k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 402k | match self.head.compare_exchange_weak( | 267 | 402k | head, | 268 | 402k | new, | 269 | 402k | Ordering::SeqCst, | 270 | 402k | Ordering::Relaxed, | 271 | 402k | ) { | 272 | 402k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 399k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 399k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 399k | return true; | 277 | | } | 278 | 3.33k | Err(h) => { | 279 | 3.33k | head = h; | 280 | 3.33k | backoff.spin(); | 281 | 3.33k | } | 282 | | } | 283 | 278k | } else if stamp == head { | 284 | 277k | atomic::fence(Ordering::SeqCst); | 285 | 277k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 277k | | 287 | 277k | // If the tail equals the head, that means the channel is empty. | 288 | 277k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 273k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 296k | return false; | 298 | | } | 299 | 4.27k | } | 300 | 4.27k | | 301 | 4.27k | backoff.spin(); | 302 | 4.27k | head = self.head.load(Ordering::Relaxed); | 303 | 1.15k | } else { | 304 | 1.15k | // Snooze because we need to wait for the stamp to get updated. | 305 | 1.15k | backoff.snooze(); | 306 | 1.15k | head = self.head.load(Ordering::Relaxed); | 307 | 1.15k | } | 308 | | } | 309 | 696k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_recv Line | Count | Source | 240 | 112k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 112k | let backoff = Backoff::new(); | 242 | 112k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 125k | loop { | 245 | 125k | // Deconstruct the head. | 246 | 125k | let index = head & (self.mark_bit - 1); | 247 | 125k | let lap = head & !(self.one_lap - 1); | 248 | 125k | | 249 | 125k | // Inspect the corresponding slot. | 250 | 125k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 125k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 125k | | 253 | 125k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 125k | if head + 1 == stamp { | 255 | 56.7k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 51.7k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 4.94k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 56.7k | match self.head.compare_exchange_weak( | 267 | 56.7k | head, | 268 | 56.7k | new, | 269 | 56.7k | Ordering::SeqCst, | 270 | 56.7k | Ordering::Relaxed, | 271 | 56.7k | ) { | 272 | 56.7k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 56.7k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 56.7k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 56.7k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 69.0k | } else if stamp == head { | 284 | 69.0k | atomic::fence(Ordering::SeqCst); | 285 | 69.0k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 69.0k | | 287 | 69.0k | // If the tail equals the head, that means the channel is empty. | 288 | 69.0k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 55.8k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 57.0k | return false; | 298 | | } | 299 | 13.2k | } | 300 | 13.2k | | 301 | 13.2k | backoff.spin(); | 302 | 13.2k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 113k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv Line | Count | Source | 240 | 2.95k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 2.95k | let backoff = Backoff::new(); | 242 | 2.95k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 3.15k | loop { | 245 | 3.15k | // Deconstruct the head. | 246 | 3.15k | let index = head & (self.mark_bit - 1); | 247 | 3.15k | let lap = head & !(self.one_lap - 1); | 248 | 3.15k | | 249 | 3.15k | // Inspect the corresponding slot. | 250 | 3.15k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 3.15k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 3.15k | | 253 | 3.15k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 3.15k | if head + 1 == stamp { | 255 | 2.00k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 1.00k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 1.00k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2.00k | match self.head.compare_exchange_weak( | 267 | 2.00k | head, | 268 | 2.00k | new, | 269 | 2.00k | Ordering::SeqCst, | 270 | 2.00k | Ordering::Relaxed, | 271 | 2.00k | ) { | 272 | 2.00k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2.00k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2.00k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 1.15k | } else if stamp == head { | 284 | 1.15k | atomic::fence(Ordering::SeqCst); | 285 | 1.15k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 1.15k | | 287 | 1.15k | // If the tail equals the head, that means the channel is empty. | 288 | 1.15k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 955 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 955 | return false; | 298 | | } | 299 | 198 | } | 300 | 198 | | 301 | 198 | backoff.spin(); | 302 | 198 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 2.95k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_recv <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::start_recv Line | Count | Source | 240 | 1 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 1 | let backoff = Backoff::new(); | 242 | 1 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 1 | loop { | 245 | 1 | // Deconstruct the head. | 246 | 1 | let index = head & (self.mark_bit - 1); | 247 | 1 | let lap = head & !(self.one_lap - 1); | 248 | 1 | | 249 | 1 | // Inspect the corresponding slot. | 250 | 1 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 1 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 1 | | 253 | 1 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 1 | if head + 1 == stamp { | 255 | 1 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 1 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 1 | match self.head.compare_exchange_weak( | 267 | 1 | head, | 268 | 1 | new, | 269 | 1 | Ordering::SeqCst, | 270 | 1 | Ordering::Relaxed, | 271 | 1 | ) { | 272 | 1 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 1 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 1 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 1 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 0 | } else if stamp == head { | 284 | 0 | atomic::fence(Ordering::SeqCst); | 285 | 0 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 0 |
| 287 | 0 | // If the tail equals the head, that means the channel is empty. | 288 | 0 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 0 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 0 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 27 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 27 | let backoff = Backoff::new(); | 242 | 27 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 27 | loop { | 245 | 27 | // Deconstruct the head. | 246 | 27 | let index = head & (self.mark_bit - 1); | 247 | 27 | let lap = head & !(self.one_lap - 1); | 248 | 27 | | 249 | 27 | // Inspect the corresponding slot. | 250 | 27 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 27 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 27 | | 253 | 27 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 27 | if head + 1 == stamp { | 255 | 10 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 10 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10 | match self.head.compare_exchange_weak( | 267 | 10 | head, | 268 | 10 | new, | 269 | 10 | Ordering::SeqCst, | 270 | 10 | Ordering::Relaxed, | 271 | 10 | ) { | 272 | 10 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 17 | } else if stamp == head { | 284 | 17 | atomic::fence(Ordering::SeqCst); | 285 | 17 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 17 | | 287 | 17 | // If the tail equals the head, that means the channel is empty. | 288 | 17 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 17 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 2 | token.array.slot = ptr::null(); | 293 | 2 | token.array.stamp = 0; | 294 | 2 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 15 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 27 | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_recv Line | Count | Source | 240 | 10.9k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 10.9k | let backoff = Backoff::new(); | 242 | 10.9k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 10.9k | loop { | 245 | 10.9k | // Deconstruct the head. | 246 | 10.9k | let index = head & (self.mark_bit - 1); | 247 | 10.9k | let lap = head & !(self.one_lap - 1); | 248 | 10.9k | | 249 | 10.9k | // Inspect the corresponding slot. | 250 | 10.9k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 10.9k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 10.9k | | 253 | 10.9k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 10.9k | if head + 1 == stamp { | 255 | 10.1k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 10.1k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 7 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.1k | match self.head.compare_exchange_weak( | 267 | 10.1k | head, | 268 | 10.1k | new, | 269 | 10.1k | Ordering::SeqCst, | 270 | 10.1k | Ordering::Relaxed, | 271 | 10.1k | ) { | 272 | 10.1k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.1k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.1k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.1k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 727 | } else if stamp == head { | 284 | 727 | atomic::fence(Ordering::SeqCst); | 285 | 727 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 727 | | 287 | 727 | // If the tail equals the head, that means the channel is empty. | 288 | 727 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 726 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 771 | return false; | 298 | | } | 299 | 1 | } | 300 | 1 | | 301 | 1 | backoff.spin(); | 302 | 1 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 10.9k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Line | Count | Source | 240 | 418k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 418k | let backoff = Backoff::new(); | 242 | 418k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 463k | loop { | 245 | 463k | // Deconstruct the head. | 246 | 463k | let index = head & (self.mark_bit - 1); | 247 | 463k | let lap = head & !(self.one_lap - 1); | 248 | 463k | | 249 | 463k | // Inspect the corresponding slot. | 250 | 463k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 463k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 463k | | 253 | 463k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 463k | if head + 1 == stamp { | 255 | 339k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 170k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 168k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 339k | match self.head.compare_exchange_weak( | 267 | 339k | head, | 268 | 339k | new, | 269 | 339k | Ordering::SeqCst, | 270 | 339k | Ordering::Relaxed, | 271 | 339k | ) { | 272 | 339k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 324k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 324k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 324k | return true; | 277 | | } | 278 | 15.3k | Err(h) => { | 279 | 15.3k | head = h; | 280 | 15.3k | backoff.spin(); | 281 | 15.3k | } | 282 | | } | 283 | 123k | } else if stamp == head { | 284 | 121k | atomic::fence(Ordering::SeqCst); | 285 | 121k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 121k | | 287 | 121k | // If the tail equals the head, that means the channel is empty. | 288 | 121k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 94.2k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 1 | token.array.slot = ptr::null(); | 293 | 1 | token.array.stamp = 0; | 294 | 1 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 106k | return false; | 298 | | } | 299 | 27.4k | } | 300 | 27.4k | | 301 | 27.4k | backoff.spin(); | 302 | 27.4k | head = self.head.load(Ordering::Relaxed); | 303 | 1.77k | } else { | 304 | 1.77k | // Snooze because we need to wait for the stamp to get updated. | 305 | 1.77k | backoff.snooze(); | 306 | 1.77k | head = self.head.load(Ordering::Relaxed); | 307 | 1.77k | } | 308 | | } | 309 | 431k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv Line | Count | Source | 240 | 4.05k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 4.05k | let backoff = Backoff::new(); | 242 | 4.05k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 4.25k | loop { | 245 | 4.25k | // Deconstruct the head. | 246 | 4.25k | let index = head & (self.mark_bit - 1); | 247 | 4.25k | let lap = head & !(self.one_lap - 1); | 248 | 4.25k | | 249 | 4.25k | // Inspect the corresponding slot. | 250 | 4.25k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 4.25k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 4.25k | | 253 | 4.25k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 4.25k | if head + 1 == stamp { | 255 | 1.00k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 1.00k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 1.00k | match self.head.compare_exchange_weak( | 267 | 1.00k | head, | 268 | 1.00k | new, | 269 | 1.00k | Ordering::SeqCst, | 270 | 1.00k | Ordering::Relaxed, | 271 | 1.00k | ) { | 272 | 1.00k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 1.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 1.00k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 1.00k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 3.25k | } else if stamp == head { | 284 | 3.25k | atomic::fence(Ordering::SeqCst); | 285 | 3.25k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 3.25k | | 287 | 3.25k | // If the tail equals the head, that means the channel is empty. | 288 | 3.25k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 3.05k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 3.05k | return false; | 298 | | } | 299 | 199 | } | 300 | 199 | | 301 | 199 | backoff.spin(); | 302 | 199 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 4.05k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::start_recv Line | Count | Source | 240 | 492k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 492k | let backoff = Backoff::new(); | 242 | 492k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 494k | loop { | 245 | 494k | // Deconstruct the head. | 246 | 494k | let index = head & (self.mark_bit - 1); | 247 | 494k | let lap = head & !(self.one_lap - 1); | 248 | 494k | | 249 | 494k | // Inspect the corresponding slot. | 250 | 494k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 494k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 494k | | 253 | 494k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 494k | if head + 1 == stamp { | 255 | 490k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 480k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 9.75k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 490k | match self.head.compare_exchange_weak( | 267 | 490k | head, | 268 | 490k | new, | 269 | 490k | Ordering::SeqCst, | 270 | 490k | Ordering::Relaxed, | 271 | 490k | ) { | 272 | 490k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 490k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 490k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 490k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 3.90k | } else if stamp == head { | 284 | 3.90k | atomic::fence(Ordering::SeqCst); | 285 | 3.90k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 3.90k | | 287 | 3.90k | // If the tail equals the head, that means the channel is empty. | 288 | 3.90k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 1.91k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 1.91k | return false; | 298 | | } | 299 | 1.98k | } | 300 | 1.98k | | 301 | 1.98k | backoff.spin(); | 302 | 1.98k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 492k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 180k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 180k | let backoff = Backoff::new(); | 242 | 180k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 191k | loop { | 245 | 191k | // Deconstruct the head. | 246 | 191k | let index = head & (self.mark_bit - 1); | 247 | 191k | let lap = head & !(self.one_lap - 1); | 248 | 191k | | 249 | 191k | // Inspect the corresponding slot. | 250 | 191k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 191k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 191k | | 253 | 191k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 191k | if head + 1 == stamp { | 255 | 117k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 80.7k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 36.6k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 117k | match self.head.compare_exchange_weak( | 267 | 117k | head, | 268 | 117k | new, | 269 | 117k | Ordering::SeqCst, | 270 | 117k | Ordering::Relaxed, | 271 | 117k | ) { | 272 | 117k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 108k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 108k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 108k | return true; | 277 | | } | 278 | 8.94k | Err(h) => { | 279 | 8.94k | head = h; | 280 | 8.94k | backoff.spin(); | 281 | 8.94k | } | 282 | | } | 283 | 73.7k | } else if stamp == head { | 284 | 72.8k | atomic::fence(Ordering::SeqCst); | 285 | 72.8k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 72.8k | | 287 | 72.8k | // If the tail equals the head, that means the channel is empty. | 288 | 72.8k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 72.3k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 4 | token.array.slot = ptr::null(); | 293 | 4 | token.array.stamp = 0; | 294 | 4 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 71.5k | return false; | 298 | | } | 299 | 425 | } | 300 | 425 | | 301 | 425 | backoff.spin(); | 302 | 425 | head = self.head.load(Ordering::Relaxed); | 303 | 956 | } else { | 304 | 956 | // Snooze because we need to wait for the stamp to get updated. | 305 | 956 | backoff.snooze(); | 306 | 956 | head = self.head.load(Ordering::Relaxed); | 307 | 956 | } | 308 | | } | 309 | 179k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_recv Line | Count | Source | 240 | 200k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 200k | let backoff = Backoff::new(); | 242 | 200k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 213k | loop { | 245 | 213k | // Deconstruct the head. | 246 | 213k | let index = head & (self.mark_bit - 1); | 247 | 213k | let lap = head & !(self.one_lap - 1); | 248 | 213k | | 249 | 213k | // Inspect the corresponding slot. | 250 | 213k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 213k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 213k | | 253 | 213k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 213k | if head + 1 == stamp { | 255 | 119k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 19.9k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 99.9k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 119k | match self.head.compare_exchange_weak( | 267 | 119k | head, | 268 | 119k | new, | 269 | 119k | Ordering::SeqCst, | 270 | 119k | Ordering::Relaxed, | 271 | 119k | ) { | 272 | 119k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 119k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 119k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 119k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 93.6k | } else if stamp == head { | 284 | 93.6k | atomic::fence(Ordering::SeqCst); | 285 | 93.6k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 93.6k | | 287 | 93.6k | // If the tail equals the head, that means the channel is empty. | 288 | 93.6k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 80.2k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 2 | token.array.slot = ptr::null(); | 293 | 2 | token.array.stamp = 0; | 294 | 2 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 80.4k | return false; | 298 | | } | 299 | 13.3k | } | 300 | 13.3k | | 301 | 13.3k | backoff.spin(); | 302 | 13.3k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 200k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv <crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 1 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 1 | let backoff = Backoff::new(); | 242 | 1 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 1 | loop { | 245 | 1 | // Deconstruct the head. | 246 | 1 | let index = head & (self.mark_bit - 1); | 247 | 1 | let lap = head & !(self.one_lap - 1); | 248 | 1 | | 249 | 1 | // Inspect the corresponding slot. | 250 | 1 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 1 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 1 | | 253 | 1 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 1 | if head + 1 == stamp { | 255 | 0 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 0 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 0 | match self.head.compare_exchange_weak( | 267 | 0 | head, | 268 | 0 | new, | 269 | 0 | Ordering::SeqCst, | 270 | 0 | Ordering::Relaxed, | 271 | 0 | ) { | 272 | 0 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 0 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 0 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 0 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 1 | } else if stamp == head { | 284 | 1 | atomic::fence(Ordering::SeqCst); | 285 | 1 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 1 | | 287 | 1 | // If the tail equals the head, that means the channel is empty. | 288 | 1 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 1 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 1 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_recv <crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 1.42M | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 1.42M | let backoff = Backoff::new(); | 242 | 1.42M | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 1.57M | loop { | 245 | 1.57M | // Deconstruct the head. | 246 | 1.57M | let index = head & (self.mark_bit - 1); | 247 | 1.57M | let lap = head & !(self.one_lap - 1); | 248 | 1.57M | | 249 | 1.57M | // Inspect the corresponding slot. | 250 | 1.57M | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 1.57M | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 1.57M | | 253 | 1.57M | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 1.57M | if head + 1 == stamp { | 255 | 716k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 681k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 34.8k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 716k | match self.head.compare_exchange_weak( | 267 | 716k | head, | 268 | 716k | new, | 269 | 716k | Ordering::SeqCst, | 270 | 716k | Ordering::Relaxed, | 271 | 716k | ) { | 272 | 716k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 638k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 638k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 638k | return true; | 277 | | } | 278 | 78.5k | Err(h) => { | 279 | 78.5k | head = h; | 280 | 78.5k | backoff.spin(); | 281 | 78.5k | } | 282 | | } | 283 | 855k | } else if stamp == head { | 284 | 854k | atomic::fence(Ordering::SeqCst); | 285 | 854k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 854k | | 287 | 854k | // If the tail equals the head, that means the channel is empty. | 288 | 854k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 791k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 1.42k | token.array.slot = ptr::null(); | 293 | 1.42k | token.array.stamp = 0; | 294 | 1.42k | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 791k | return false; | 298 | | } | 299 | 62.3k | } | 300 | 62.3k | | 301 | 62.3k | backoff.spin(); | 302 | 62.3k | head = self.head.load(Ordering::Relaxed); | 303 | 1.39k | } else { | 304 | 1.39k | // Snooze because we need to wait for the stamp to get updated. | 305 | 1.39k | backoff.snooze(); | 306 | 1.39k | head = self.head.load(Ordering::Relaxed); | 307 | 1.39k | } | 308 | | } | 309 | 1.43M | } |
<crossbeam_channel::flavors::array::Channel<u32>>::start_recv Line | Count | Source | 240 | 2 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 2 | let backoff = Backoff::new(); | 242 | 2 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 2 | loop { | 245 | 2 | // Deconstruct the head. | 246 | 2 | let index = head & (self.mark_bit - 1); | 247 | 2 | let lap = head & !(self.one_lap - 1); | 248 | 2 | | 249 | 2 | // Inspect the corresponding slot. | 250 | 2 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 2 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 2 | | 253 | 2 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 2 | if head + 1 == stamp { | 255 | 2 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2 | match self.head.compare_exchange_weak( | 267 | 2 | head, | 268 | 2 | new, | 269 | 2 | Ordering::SeqCst, | 270 | 2 | Ordering::Relaxed, | 271 | 2 | ) { | 272 | 2 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 0 | } else if stamp == head { | 284 | 0 | atomic::fence(Ordering::SeqCst); | 285 | 0 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 0 |
| 287 | 0 | // If the tail equals the head, that means the channel is empty. | 288 | 0 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 0 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 0 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::start_recv <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Line | Count | Source | 240 | 3.60k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 3.60k | let backoff = Backoff::new(); | 242 | 3.60k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 3.81k | loop { | 245 | 3.81k | // Deconstruct the head. | 246 | 3.81k | let index = head & (self.mark_bit - 1); | 247 | 3.81k | let lap = head & !(self.one_lap - 1); | 248 | 3.81k | | 249 | 3.81k | // Inspect the corresponding slot. | 250 | 3.81k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 3.81k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 3.81k | | 253 | 3.81k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 3.81k | if head + 1 == stamp { | 255 | 1.09k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 547 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 543 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 1.09k | match self.head.compare_exchange_weak( | 267 | 1.09k | head, | 268 | 1.09k | new, | 269 | 1.09k | Ordering::SeqCst, | 270 | 1.09k | Ordering::Relaxed, | 271 | 1.09k | ) { | 272 | 1.09k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 978 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 978 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 978 | return true; | 277 | | } | 278 | 112 | Err(h) => { | 279 | 112 | head = h; | 280 | 112 | backoff.spin(); | 281 | 112 | } | 282 | | } | 283 | 2.72k | } else if stamp == head { | 284 | 2.72k | atomic::fence(Ordering::SeqCst); | 285 | 2.72k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 2.72k | | 287 | 2.72k | // If the tail equals the head, that means the channel is empty. | 288 | 2.72k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 2.62k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 2.62k | return false; | 298 | | } | 299 | 99 | } | 300 | 99 | | 301 | 99 | backoff.spin(); | 302 | 99 | head = self.head.load(Ordering::Relaxed); | 303 | 3 | } else { | 304 | 3 | // Snooze because we need to wait for the stamp to get updated. | 305 | 3 | backoff.snooze(); | 306 | 3 | head = self.head.load(Ordering::Relaxed); | 307 | 3 | } | 308 | | } | 309 | 3.60k | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::start_recv Line | Count | Source | 240 | 3 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 3 | let backoff = Backoff::new(); | 242 | 3 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 3 | loop { | 245 | 3 | // Deconstruct the head. | 246 | 3 | let index = head & (self.mark_bit - 1); | 247 | 3 | let lap = head & !(self.one_lap - 1); | 248 | 3 | | 249 | 3 | // Inspect the corresponding slot. | 250 | 3 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 3 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 3 | | 253 | 3 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 3 | if head + 1 == stamp { | 255 | 2 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2 | match self.head.compare_exchange_weak( | 267 | 2 | head, | 268 | 2 | new, | 269 | 2 | Ordering::SeqCst, | 270 | 2 | Ordering::Relaxed, | 271 | 2 | ) { | 272 | 2 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 1 | } else if stamp == head { | 284 | 1 | atomic::fence(Ordering::SeqCst); | 285 | 1 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 1 | | 287 | 1 | // If the tail equals the head, that means the channel is empty. | 288 | 1 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 1 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 1 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 3 | } |
<crossbeam_channel::flavors::array::Channel<u8>>::start_recv Line | Count | Source | 240 | 10.0k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 10.0k | let backoff = Backoff::new(); | 242 | 10.0k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 10.0k | loop { | 245 | 10.0k | // Deconstruct the head. | 246 | 10.0k | let index = head & (self.mark_bit - 1); | 247 | 10.0k | let lap = head & !(self.one_lap - 1); | 248 | 10.0k | | 249 | 10.0k | // Inspect the corresponding slot. | 250 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 10.0k | | 253 | 10.0k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 10.0k | if head + 1 == stamp { | 255 | 10.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 10.0k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 0 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.0k | match self.head.compare_exchange_weak( | 267 | 10.0k | head, | 268 | 10.0k | new, | 269 | 10.0k | Ordering::SeqCst, | 270 | 10.0k | Ordering::Relaxed, | 271 | 10.0k | ) { | 272 | 10.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 0 | } else if stamp == head { | 284 | 0 | atomic::fence(Ordering::SeqCst); | 285 | 0 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 0 |
| 287 | 0 | // If the tail equals the head, that means the channel is empty. | 288 | 0 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 0 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 0 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<bool>>::start_recv Line | Count | Source | 240 | 16.3k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 16.3k | let backoff = Backoff::new(); | 242 | 16.3k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 16.4k | loop { | 245 | 16.4k | // Deconstruct the head. | 246 | 16.4k | let index = head & (self.mark_bit - 1); | 247 | 16.4k | let lap = head & !(self.one_lap - 1); | 248 | 16.4k | | 249 | 16.4k | // Inspect the corresponding slot. | 250 | 16.4k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 16.4k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 16.4k | | 253 | 16.4k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 16.4k | if head + 1 == stamp { | 255 | 2.00k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2.00k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2.00k | match self.head.compare_exchange_weak( | 267 | 2.00k | head, | 268 | 2.00k | new, | 269 | 2.00k | Ordering::SeqCst, | 270 | 2.00k | Ordering::Relaxed, | 271 | 2.00k | ) { | 272 | 2.00k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2.00k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2.00k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 14.4k | } else if stamp == head { | 284 | 14.4k | atomic::fence(Ordering::SeqCst); | 285 | 14.4k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 14.4k | | 287 | 14.4k | // If the tail equals the head, that means the channel is empty. | 288 | 14.4k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 14.3k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 14.3k | return false; | 298 | | } | 299 | 50 | } | 300 | 50 | | 301 | 50 | backoff.spin(); | 302 | 50 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 16.3k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::start_recv Line | Count | Source | 240 | 3 | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 3 | let backoff = Backoff::new(); | 242 | 3 | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 3 | loop { | 245 | 3 | // Deconstruct the head. | 246 | 3 | let index = head & (self.mark_bit - 1); | 247 | 3 | let lap = head & !(self.one_lap - 1); | 248 | 3 | | 249 | 3 | // Inspect the corresponding slot. | 250 | 3 | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 3 | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 3 | | 253 | 3 | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 3 | if head + 1 == stamp { | 255 | 2 | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2 | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2 | match self.head.compare_exchange_weak( | 267 | 2 | head, | 268 | 2 | new, | 269 | 2 | Ordering::SeqCst, | 270 | 2 | Ordering::Relaxed, | 271 | 2 | ) { | 272 | 2 | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2 | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2 | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2 | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 1 | } else if stamp == head { | 284 | 1 | atomic::fence(Ordering::SeqCst); | 285 | 1 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 1 | | 287 | 1 | // If the tail equals the head, that means the channel is empty. | 288 | 1 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 1 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 1 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 3 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv Line | Count | Source | 240 | 9.80k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 9.80k | let backoff = Backoff::new(); | 242 | 9.80k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 10.5k | loop { | 245 | 10.5k | // Deconstruct the head. | 246 | 10.5k | let index = head & (self.mark_bit - 1); | 247 | 10.5k | let lap = head & !(self.one_lap - 1); | 248 | 10.5k | | 249 | 10.5k | // Inspect the corresponding slot. | 250 | 10.5k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 10.5k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 10.5k | | 253 | 10.5k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 10.5k | if head + 1 == stamp { | 255 | 2.00k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 1.00k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 1.00k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 2.00k | match self.head.compare_exchange_weak( | 267 | 2.00k | head, | 268 | 2.00k | new, | 269 | 2.00k | Ordering::SeqCst, | 270 | 2.00k | Ordering::Relaxed, | 271 | 2.00k | ) { | 272 | 2.00k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 2.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 2.00k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 2.00k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 8.54k | } else if stamp == head { | 284 | 8.54k | atomic::fence(Ordering::SeqCst); | 285 | 8.54k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 8.54k | | 287 | 8.54k | // If the tail equals the head, that means the channel is empty. | 288 | 8.54k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 7.80k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 7.80k | return false; | 298 | | } | 299 | 738 | } | 300 | 738 | | 301 | 738 | backoff.spin(); | 302 | 738 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 9.80k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::start_recv Line | Count | Source | 240 | 620k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 620k | let backoff = Backoff::new(); | 242 | 620k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 670k | loop { | 245 | 670k | // Deconstruct the head. | 246 | 670k | let index = head & (self.mark_bit - 1); | 247 | 670k | let lap = head & !(self.one_lap - 1); | 248 | 670k | | 249 | 670k | // Inspect the corresponding slot. | 250 | 670k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 670k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 670k | | 253 | 670k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 670k | if head + 1 == stamp { | 255 | 425k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 0 | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 425k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 425k | match self.head.compare_exchange_weak( | 267 | 425k | head, | 268 | 425k | new, | 269 | 425k | Ordering::SeqCst, | 270 | 425k | Ordering::Relaxed, | 271 | 425k | ) { | 272 | 425k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 397k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 397k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 397k | return true; | 277 | | } | 278 | 28.4k | Err(h) => { | 279 | 28.4k | head = h; | 280 | 28.4k | backoff.spin(); | 281 | 28.4k | } | 282 | | } | 283 | 245k | } else if stamp == head { | 284 | 234k | atomic::fence(Ordering::SeqCst); | 285 | 234k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 234k | | 287 | 234k | // If the tail equals the head, that means the channel is empty. | 288 | 234k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 223k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 281k | return false; | 298 | | } | 299 | 10.9k | } | 300 | 10.9k | | 301 | 10.9k | backoff.spin(); | 302 | 10.9k | head = self.head.load(Ordering::Relaxed); | 303 | 11.1k | } else { | 304 | 11.1k | // Snooze because we need to wait for the stamp to get updated. | 305 | 11.1k | backoff.snooze(); | 306 | 11.1k | head = self.head.load(Ordering::Relaxed); | 307 | 11.1k | } | 308 | | } | 309 | 678k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_recv Line | Count | Source | 240 | 117k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 117k | let backoff = Backoff::new(); | 242 | 117k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 124k | loop { | 245 | 124k | // Deconstruct the head. | 246 | 124k | let index = head & (self.mark_bit - 1); | 247 | 124k | let lap = head & !(self.one_lap - 1); | 248 | 124k | | 249 | 124k | // Inspect the corresponding slot. | 250 | 124k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 124k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 124k | | 253 | 124k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 124k | if head + 1 == stamp { | 255 | 52.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 46.9k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 5.06k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 52.0k | match self.head.compare_exchange_weak( | 267 | 52.0k | head, | 268 | 52.0k | new, | 269 | 52.0k | Ordering::SeqCst, | 270 | 52.0k | Ordering::Relaxed, | 271 | 52.0k | ) { | 272 | 52.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 52.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 52.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 52.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 72.4k | } else if stamp == head { | 284 | 72.4k | atomic::fence(Ordering::SeqCst); | 285 | 72.4k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 72.4k | | 287 | 72.4k | // If the tail equals the head, that means the channel is empty. | 288 | 72.4k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 65.9k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 66.0k | return false; | 298 | | } | 299 | 6.51k | } | 300 | 6.51k | | 301 | 6.51k | backoff.spin(); | 302 | 6.51k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 118k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Line | Count | Source | 240 | 21.5k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 21.5k | let backoff = Backoff::new(); | 242 | 21.5k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 22.7k | loop { | 245 | 22.7k | // Deconstruct the head. | 246 | 22.7k | let index = head & (self.mark_bit - 1); | 247 | 22.7k | let lap = head & !(self.one_lap - 1); | 248 | 22.7k | | 249 | 22.7k | // Inspect the corresponding slot. | 250 | 22.7k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 22.7k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 22.7k | | 253 | 22.7k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 22.7k | if head + 1 == stamp { | 255 | 10.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 8.01k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2.01k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.0k | match self.head.compare_exchange_weak( | 267 | 10.0k | head, | 268 | 10.0k | new, | 269 | 10.0k | Ordering::SeqCst, | 270 | 10.0k | Ordering::Relaxed, | 271 | 10.0k | ) { | 272 | 10.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 12.7k | } else if stamp == head { | 284 | 12.7k | atomic::fence(Ordering::SeqCst); | 285 | 12.7k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 12.7k | | 287 | 12.7k | // If the tail equals the head, that means the channel is empty. | 288 | 12.7k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 11.5k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 11.5k | return false; | 298 | | } | 299 | 1.15k | } | 300 | 1.15k | | 301 | 1.15k | backoff.spin(); | 302 | 1.15k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 21.5k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::start_recv Line | Count | Source | 240 | 3.00k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 3.00k | let backoff = Backoff::new(); | 242 | 3.00k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 3.00k | loop { | 245 | 3.00k | // Deconstruct the head. | 246 | 3.00k | let index = head & (self.mark_bit - 1); | 247 | 3.00k | let lap = head & !(self.one_lap - 1); | 248 | 3.00k | | 249 | 3.00k | // Inspect the corresponding slot. | 250 | 3.00k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 3.00k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 3.00k | | 253 | 3.00k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 3.00k | if head + 1 == stamp { | 255 | 3.00k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 2.00k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 1.00k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 3.00k | match self.head.compare_exchange_weak( | 267 | 3.00k | head, | 268 | 3.00k | new, | 269 | 3.00k | Ordering::SeqCst, | 270 | 3.00k | Ordering::Relaxed, | 271 | 3.00k | ) { | 272 | 3.00k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 3.00k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 3.00k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 3.00k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 0 | } else if stamp == head { | 284 | 0 | atomic::fence(Ordering::SeqCst); | 285 | 0 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 0 |
| 287 | 0 | // If the tail equals the head, that means the channel is empty. | 288 | 0 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 0 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 0 | return false; | 298 | | } | 299 | 0 | } | 300 | 0 |
| 301 | 0 | backoff.spin(); | 302 | 0 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::start_recv Line | Count | Source | 240 | 66.4k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 66.4k | let backoff = Backoff::new(); | 242 | 66.4k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 71.7k | loop { | 245 | 71.7k | // Deconstruct the head. | 246 | 71.7k | let index = head & (self.mark_bit - 1); | 247 | 71.7k | let lap = head & !(self.one_lap - 1); | 248 | 71.7k | | 249 | 71.7k | // Inspect the corresponding slot. | 250 | 71.7k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 71.7k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 71.7k | | 253 | 71.7k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 71.7k | if head + 1 == stamp { | 255 | 64.3k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 22.2k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 42.1k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 64.3k | match self.head.compare_exchange_weak( | 267 | 64.3k | head, | 268 | 64.3k | new, | 269 | 64.3k | Ordering::SeqCst, | 270 | 64.3k | Ordering::Relaxed, | 271 | 64.3k | ) { | 272 | 64.3k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 64.3k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 64.3k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 64.3k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 7.42k | } else if stamp == head { | 284 | 7.42k | atomic::fence(Ordering::SeqCst); | 285 | 7.42k | let tail = self.tail.load(Ordering::Relaxed); | 286 | 7.42k | | 287 | 7.42k | // If the tail equals the head, that means the channel is empty. | 288 | 7.42k | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 2.05k | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 2.61k | return false; | 298 | | } | 299 | 5.37k | } | 300 | 5.37k | | 301 | 5.37k | backoff.spin(); | 302 | 5.37k | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 66.9k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::start_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::start_recv <crossbeam_channel::flavors::array::Channel<usize>>::start_recv Line | Count | Source | 240 | 10.0k | fn start_recv(&self, token: &mut Token) -> bool { | 241 | 10.0k | let backoff = Backoff::new(); | 242 | 10.0k | let mut head = self.head.load(Ordering::Relaxed); | 243 | | | 244 | 10.0k | loop { | 245 | 10.0k | // Deconstruct the head. | 246 | 10.0k | let index = head & (self.mark_bit - 1); | 247 | 10.0k | let lap = head & !(self.one_lap - 1); | 248 | 10.0k | | 249 | 10.0k | // Inspect the corresponding slot. | 250 | 10.0k | let slot = unsafe { &*self.buffer.add(index) }; | 251 | 10.0k | let stamp = slot.stamp.load(Ordering::Acquire); | 252 | 10.0k | | 253 | 10.0k | // If the the stamp is ahead of the head by 1, we may attempt to pop. | 254 | 10.0k | if head + 1 == stamp { | 255 | 10.0k | let new = if index + 1 < self.cap { | 256 | | // Same lap, incremented index. | 257 | | // Set to `{ lap: lap, mark: 0, index: index + 1 }`. | 258 | 8.01k | head + 1 | 259 | | } else { | 260 | | // One lap forward, index wraps around to zero. | 261 | | // Set to `{ lap: lap.wrapping_add(1), mark: 0, index: 0 }`. | 262 | 2.01k | lap.wrapping_add(self.one_lap) | 263 | | }; | 264 | | | 265 | | // Try moving the head. | 266 | 10.0k | match self.head.compare_exchange_weak( | 267 | 10.0k | head, | 268 | 10.0k | new, | 269 | 10.0k | Ordering::SeqCst, | 270 | 10.0k | Ordering::Relaxed, | 271 | 10.0k | ) { | 272 | 10.0k | Ok(_) => { | 273 | | // Prepare the token for the follow-up call to `read`. | 274 | 10.0k | token.array.slot = slot as *const Slot<T> as *const u8; | 275 | 10.0k | token.array.stamp = head.wrapping_add(self.one_lap); | 276 | 10.0k | return true; | 277 | | } | 278 | 0 | Err(h) => { | 279 | 0 | head = h; | 280 | 0 | backoff.spin(); | 281 | 0 | } | 282 | | } | 283 | 4 | } else if stamp == head { | 284 | 4 | atomic::fence(Ordering::SeqCst); | 285 | 4 | let tail = self.tail.load(Ordering::Relaxed); | 286 | 4 | | 287 | 4 | // If the tail equals the head, that means the channel is empty. | 288 | 4 | if (tail & !self.mark_bit) == head { | 289 | | // If the channel is disconnected... | 290 | 0 | if tail & self.mark_bit != 0 { | 291 | | // ...then receive an error. | 292 | 0 | token.array.slot = ptr::null(); | 293 | 0 | token.array.stamp = 0; | 294 | 0 | return true; | 295 | | } else { | 296 | | // Otherwise, the receive operation is not ready. | 297 | 0 | return false; | 298 | | } | 299 | 4 | } | 300 | 4 | | 301 | 4 | backoff.spin(); | 302 | 4 | head = self.head.load(Ordering::Relaxed); | 303 | 0 | } else { | 304 | 0 | // Snooze because we need to wait for the stamp to get updated. | 305 | 0 | backoff.snooze(); | 306 | 0 | head = self.head.load(Ordering::Relaxed); | 307 | 0 | } | 308 | | } | 309 | 10.0k | } |
|
310 | | |
311 | | /// Reads a message from the channel. |
312 | 2.73M | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { |
313 | 2.73M | if token.array.slot.is_null() { |
314 | | // The channel is disconnected. |
315 | 1.43k | return Err(()); |
316 | 2.72M | } |
317 | 2.72M | |
318 | 2.72M | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); |
319 | 2.72M | |
320 | 2.72M | // Read the message from the slot and update the stamp. |
321 | 2.72M | let msg = slot.msg.get().read().assume_init(); |
322 | 2.72M | slot.stamp.store(token.array.stamp, Ordering::Release); |
323 | 2.72M | |
324 | 2.72M | // Wake a sleeping sender. |
325 | 2.72M | self.senders.notify(); |
326 | 2.72M | Ok(msg) |
327 | 2.73M | } <crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 10.0k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.0k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.0k | } | 317 | 10.0k | | 318 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.0k | | 320 | 10.0k | // Read the message from the slot and update the stamp. | 321 | 10.0k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.0k | | 324 | 10.0k | // Wake a sleeping sender. | 325 | 10.0k | self.senders.notify(); | 326 | 10.0k | Ok(msg) | 327 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::read <crossbeam_channel::flavors::array::Channel<usize>>::read Line | Count | Source | 312 | 10.0k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.0k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.0k | } | 317 | 10.0k | | 318 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.0k | | 320 | 10.0k | // Read the message from the slot and update the stamp. | 321 | 10.0k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.0k | | 324 | 10.0k | // Wake a sleeping sender. | 325 | 10.0k | self.senders.notify(); | 326 | 10.0k | Ok(msg) | 327 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Line | Count | Source | 312 | 2.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2.00k | } | 317 | 2.00k | | 318 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2.00k | | 320 | 2.00k | // Read the message from the slot and update the stamp. | 321 | 2.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2.00k | | 324 | 2.00k | // Wake a sleeping sender. | 325 | 2.00k | self.senders.notify(); | 326 | 2.00k | Ok(msg) | 327 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::read Line | Count | Source | 312 | 56.6k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 56.6k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 56.6k | } | 317 | 56.6k | | 318 | 56.6k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 56.6k | | 320 | 56.6k | // Read the message from the slot and update the stamp. | 321 | 56.6k | let msg = slot.msg.get().read().assume_init(); | 322 | 56.6k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 56.6k | | 324 | 56.6k | // Wake a sleeping sender. | 325 | 56.6k | self.senders.notify(); | 326 | 56.6k | Ok(msg) | 327 | 56.6k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read <crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 397k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 397k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 397k | } | 317 | 397k | | 318 | 397k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 397k | | 320 | 397k | // Read the message from the slot and update the stamp. | 321 | 397k | let msg = slot.msg.get().read().assume_init(); | 322 | 397k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 397k | | 324 | 397k | // Wake a sleeping sender. | 325 | 397k | self.senders.notify(); | 326 | 397k | Ok(msg) | 327 | 397k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::read <crossbeam_channel::flavors::array::Channel<()>>::read Line | Count | Source | 312 | 10.1k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.1k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.1k | } | 317 | 10.1k | | 318 | 10.1k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.1k | | 320 | 10.1k | // Read the message from the slot and update the stamp. | 321 | 10.1k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.1k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.1k | | 324 | 10.1k | // Wake a sleeping sender. | 325 | 10.1k | self.senders.notify(); | 326 | 10.1k | Ok(msg) | 327 | 10.1k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 12 | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 12 | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 2 | return Err(()); | 316 | 10 | } | 317 | 10 | | 318 | 10 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10 | | 320 | 10 | // Read the message from the slot and update the stamp. | 321 | 10 | let msg = slot.msg.get().read().assume_init(); | 322 | 10 | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10 | | 324 | 10 | // Wake a sleeping sender. | 325 | 10 | self.senders.notify(); | 326 | 10 | Ok(msg) | 327 | 12 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::read <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::read Line | Count | Source | 312 | 1 | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 1 | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 1 | } | 317 | 1 | | 318 | 1 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 1 | | 320 | 1 | // Read the message from the slot and update the stamp. | 321 | 1 | let msg = slot.msg.get().read().assume_init(); | 322 | 1 | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 1 | | 324 | 1 | // Wake a sleeping sender. | 325 | 1 | self.senders.notify(); | 326 | 1 | Ok(msg) | 327 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read <crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::read Line | Count | Source | 312 | 490k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 490k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 490k | } | 317 | 490k | | 318 | 490k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 490k | | 320 | 490k | // Read the message from the slot and update the stamp. | 321 | 490k | let msg = slot.msg.get().read().assume_init(); | 322 | 490k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 490k | | 324 | 490k | // Wake a sleeping sender. | 325 | 490k | self.senders.notify(); | 326 | 490k | Ok(msg) | 327 | 490k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 110k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 110k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 4 | return Err(()); | 316 | 110k | } | 317 | 110k | | 318 | 110k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 110k | | 320 | 110k | // Read the message from the slot and update the stamp. | 321 | 110k | let msg = slot.msg.get().read().assume_init(); | 322 | 110k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 110k | | 324 | 110k | // Wake a sleeping sender. | 325 | 110k | self.senders.notify(); | 326 | 110k | Ok(msg) | 327 | 110k | } |
<crossbeam_channel::flavors::array::Channel<()>>::read Line | Count | Source | 312 | 119k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 119k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 2 | return Err(()); | 316 | 119k | } | 317 | 119k | | 318 | 119k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 119k | | 320 | 119k | // Read the message from the slot and update the stamp. | 321 | 119k | let msg = slot.msg.get().read().assume_init(); | 322 | 119k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 119k | | 324 | 119k | // Wake a sleeping sender. | 325 | 119k | self.senders.notify(); | 326 | 119k | Ok(msg) | 327 | 119k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Line | Count | Source | 312 | 1.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 1.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 1.00k | } | 317 | 1.00k | | 318 | 1.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 1.00k | | 320 | 1.00k | // Read the message from the slot and update the stamp. | 321 | 1.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 1.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 1.00k | | 324 | 1.00k | // Wake a sleeping sender. | 325 | 1.00k | self.senders.notify(); | 326 | 1.00k | Ok(msg) | 327 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::read Line | Count | Source | 312 | 322k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 322k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 1 | return Err(()); | 316 | 322k | } | 317 | 322k | | 318 | 322k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 322k | | 320 | 322k | // Read the message from the slot and update the stamp. | 321 | 322k | let msg = slot.msg.get().read().assume_init(); | 322 | 322k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 322k | | 324 | 322k | // Wake a sleeping sender. | 325 | 322k | self.senders.notify(); | 326 | 322k | Ok(msg) | 327 | 322k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::read Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read <crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 654k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 654k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 1.42k | return Err(()); | 316 | 653k | } | 317 | 653k | | 318 | 653k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 653k | | 320 | 653k | // Read the message from the slot and update the stamp. | 321 | 653k | let msg = slot.msg.get().read().assume_init(); | 322 | 653k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 653k | | 324 | 653k | // Wake a sleeping sender. | 325 | 653k | self.senders.notify(); | 326 | 653k | Ok(msg) | 327 | 654k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::read Line | Count | Source | 312 | 1.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 1.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 1.00k | } | 317 | 1.00k | | 318 | 1.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 1.00k | | 320 | 1.00k | // Read the message from the slot and update the stamp. | 321 | 1.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 1.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 1.00k | | 324 | 1.00k | // Wake a sleeping sender. | 325 | 1.00k | self.senders.notify(); | 326 | 1.00k | Ok(msg) | 327 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<u8>>::read Line | Count | Source | 312 | 10.0k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.0k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.0k | } | 317 | 10.0k | | 318 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.0k | | 320 | 10.0k | // Read the message from the slot and update the stamp. | 321 | 10.0k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.0k | | 324 | 10.0k | // Wake a sleeping sender. | 325 | 10.0k | self.senders.notify(); | 326 | 10.0k | Ok(msg) | 327 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<bool>>::read Line | Count | Source | 312 | 2.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2.00k | } | 317 | 2.00k | | 318 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2.00k | | 320 | 2.00k | // Read the message from the slot and update the stamp. | 321 | 2.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2.00k | | 324 | 2.00k | // Wake a sleeping sender. | 325 | 2.00k | self.senders.notify(); | 326 | 2.00k | Ok(msg) | 327 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::read Line | Count | Source | 312 | 2 | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2 | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2 | } | 317 | 2 | | 318 | 2 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2 | | 320 | 2 | // Read the message from the slot and update the stamp. | 321 | 2 | let msg = slot.msg.get().read().assume_init(); | 322 | 2 | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2 | | 324 | 2 | // Wake a sleeping sender. | 325 | 2 | self.senders.notify(); | 326 | 2 | Ok(msg) | 327 | 2 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::read Line | Count | Source | 312 | 2 | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2 | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2 | } | 317 | 2 | | 318 | 2 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2 | | 320 | 2 | // Read the message from the slot and update the stamp. | 321 | 2 | let msg = slot.msg.get().read().assume_init(); | 322 | 2 | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2 | | 324 | 2 | // Wake a sleeping sender. | 325 | 2 | self.senders.notify(); | 326 | 2 | Ok(msg) | 327 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::read Line | Count | Source | 312 | 2 | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2 | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2 | } | 317 | 2 | | 318 | 2 | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2 | | 320 | 2 | // Read the message from the slot and update the stamp. | 321 | 2 | let msg = slot.msg.get().read().assume_init(); | 322 | 2 | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2 | | 324 | 2 | // Wake a sleeping sender. | 325 | 2 | self.senders.notify(); | 326 | 2 | Ok(msg) | 327 | 2 | } |
<crossbeam_channel::flavors::array::Channel<()>>::read Line | Count | Source | 312 | 51.9k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 51.9k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 51.9k | } | 317 | 51.9k | | 318 | 51.9k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 51.9k | | 320 | 51.9k | // Read the message from the slot and update the stamp. | 321 | 51.9k | let msg = slot.msg.get().read().assume_init(); | 322 | 51.9k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 51.9k | | 324 | 51.9k | // Wake a sleeping sender. | 325 | 51.9k | self.senders.notify(); | 326 | 51.9k | Ok(msg) | 327 | 51.9k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Line | Count | Source | 312 | 2.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 2.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 2.00k | } | 317 | 2.00k | | 318 | 2.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 2.00k | | 320 | 2.00k | // Read the message from the slot and update the stamp. | 321 | 2.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 2.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 2.00k | | 324 | 2.00k | // Wake a sleeping sender. | 325 | 2.00k | self.senders.notify(); | 326 | 2.00k | Ok(msg) | 327 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::read Line | Count | Source | 312 | 391k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 391k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 391k | } | 317 | 391k | | 318 | 391k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 391k | | 320 | 391k | // Read the message from the slot and update the stamp. | 321 | 391k | let msg = slot.msg.get().read().assume_init(); | 322 | 391k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 391k | | 324 | 391k | // Wake a sleeping sender. | 325 | 391k | self.senders.notify(); | 326 | 391k | Ok(msg) | 327 | 391k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::read Line | Count | Source | 312 | 10.0k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.0k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.0k | } | 317 | 10.0k | | 318 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.0k | | 320 | 10.0k | // Read the message from the slot and update the stamp. | 321 | 10.0k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.0k | | 324 | 10.0k | // Wake a sleeping sender. | 325 | 10.0k | self.senders.notify(); | 326 | 10.0k | Ok(msg) | 327 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::read Line | Count | Source | 312 | 3.00k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 3.00k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 3.00k | } | 317 | 3.00k | | 318 | 3.00k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 3.00k | | 320 | 3.00k | // Read the message from the slot and update the stamp. | 321 | 3.00k | let msg = slot.msg.get().read().assume_init(); | 322 | 3.00k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 3.00k | | 324 | 3.00k | // Wake a sleeping sender. | 325 | 3.00k | self.senders.notify(); | 326 | 3.00k | Ok(msg) | 327 | 3.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::read <crossbeam_channel::flavors::array::Channel<usize>>::read Line | Count | Source | 312 | 10.0k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 10.0k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 10.0k | } | 317 | 10.0k | | 318 | 10.0k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 10.0k | | 320 | 10.0k | // Read the message from the slot and update the stamp. | 321 | 10.0k | let msg = slot.msg.get().read().assume_init(); | 322 | 10.0k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 10.0k | | 324 | 10.0k | // Wake a sleeping sender. | 325 | 10.0k | self.senders.notify(); | 326 | 10.0k | Ok(msg) | 327 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::read Line | Count | Source | 312 | 64.2k | pub(crate) unsafe fn read(&self, token: &mut Token) -> Result<T, ()> { | 313 | 64.2k | if token.array.slot.is_null() { | 314 | | // The channel is disconnected. | 315 | 0 | return Err(()); | 316 | 64.2k | } | 317 | 64.2k | | 318 | 64.2k | let slot: &Slot<T> = &*(token.array.slot as *const Slot<T>); | 319 | 64.2k | | 320 | 64.2k | // Read the message from the slot and update the stamp. | 321 | 64.2k | let msg = slot.msg.get().read().assume_init(); | 322 | 64.2k | slot.stamp.store(token.array.stamp, Ordering::Release); | 323 | 64.2k | | 324 | 64.2k | // Wake a sleeping sender. | 325 | 64.2k | self.senders.notify(); | 326 | 64.2k | Ok(msg) | 327 | 64.2k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::read |
328 | | |
329 | | /// Attempts to send a message into the channel. |
330 | 3.23k | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { |
331 | 3.23k | let token = &mut Token::default(); |
332 | 3.23k | if self.start_send(token) { |
333 | 3.22k | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } |
334 | | } else { |
335 | 2 | Err(TrySendError::Full(msg)) |
336 | | } |
337 | 3.23k | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::try_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_send <crossbeam_channel::flavors::array::Channel<i32>>::try_send Line | Count | Source | 330 | 5 | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { | 331 | 5 | let token = &mut Token::default(); | 332 | 5 | if self.start_send(token) { | 333 | 4 | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } | 334 | | } else { | 335 | 1 | Err(TrySendError::Full(msg)) | 336 | | } | 337 | 5 | } |
<crossbeam_channel::flavors::array::Channel<()>>::try_send Line | Count | Source | 330 | 200 | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { | 331 | 200 | let token = &mut Token::default(); | 332 | 200 | if self.start_send(token) { | 333 | 200 | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } | 334 | | } else { | 335 | 0 | Err(TrySendError::Full(msg)) | 336 | | } | 337 | 200 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::try_send Line | Count | Source | 330 | 5 | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { | 331 | 5 | let token = &mut Token::default(); | 332 | 5 | if self.start_send(token) { | 333 | 4 | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } | 334 | | } else { | 335 | 1 | Err(TrySendError::Full(msg)) | 336 | | } | 337 | 5 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::try_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_send <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::try_send Line | Count | Source | 330 | 3.00k | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { | 331 | 3.00k | let token = &mut Token::default(); | 332 | 3.00k | if self.start_send(token) { | 333 | 3.00k | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } | 334 | | } else { | 335 | 0 | Err(TrySendError::Full(msg)) | 336 | | } | 337 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::try_send Line | Count | Source | 330 | 20 | pub(crate) fn try_send(&self, msg: T) -> Result<(), TrySendError<T>> { | 331 | 20 | let token = &mut Token::default(); | 332 | 20 | if self.start_send(token) { | 333 | 20 | unsafe { self.write(token, msg).map_err(TrySendError::Disconnected) } | 334 | | } else { | 335 | 0 | Err(TrySendError::Full(msg)) | 336 | | } | 337 | 20 | } |
|
338 | | |
339 | | /// Sends a message into the channel. |
340 | 2.70M | pub(crate) fn send( |
341 | 2.70M | &self, |
342 | 2.70M | msg: T, |
343 | 2.70M | deadline: Option<Instant>, |
344 | 2.70M | ) -> Result<(), SendTimeoutError<T>> { |
345 | 2.70M | let token = &mut Token::default(); |
346 | | loop { |
347 | | // Try sending a message several times. |
348 | 2.71M | let backoff = Backoff::new(); |
349 | 3.25M | loop { |
350 | 3.25M | if self.start_send(token) { |
351 | 2.72M | let res = unsafe { self.write(token, msg) }; |
352 | 2.72M | return res.map_err(SendTimeoutError::Disconnected); |
353 | 530k | } |
354 | 530k | |
355 | 530k | if backoff.is_completed() { |
356 | 18.4E | break; |
357 | 533k | } else { |
358 | 533k | backoff.snooze(); |
359 | 533k | } |
360 | | } |
361 | | |
362 | 18.4E | if let Some(d18.4E ) = deadline { |
363 | 18.4E | if Instant::now() >= d { |
364 | 1 | return Err(SendTimeoutError::Timeout(msg)); |
365 | 1 | } |
366 | 17.1k | } |
367 | | |
368 | 17.1k | Context::with(|cx| { |
369 | 17.0k | // Prepare for blocking until a receiver wakes us up. |
370 | 17.0k | let oper = Operation::hook(token); |
371 | 17.0k | self.senders.register(oper, cx); |
372 | | |
373 | | // Has the channel become ready just now? |
374 | 17.0k | if !self.is_full() || self.is_disconnected()13.9k { |
375 | 3.13k | let _ = cx.try_select(Selected::Aborted); |
376 | 14.0k | } |
377 | | |
378 | | // Block the current thread. |
379 | 17.2k | let sel = cx.wait_until(deadline); |
380 | 17.2k | |
381 | 17.2k | match sel { |
382 | 17.2k | Selected::Waiting => unreachable!()88 , |
383 | 3.13k | Selected::Aborted | Selected::Disconnected => { |
384 | 3.13k | self.senders.unregister(oper).unwrap(); |
385 | 3.13k | } |
386 | 13.9k | Selected::Operation(_) => {} |
387 | | } |
388 | 17.1k | }17.1k ); Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::send::{closure#0} <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Line | Count | Source | 368 | 12 | Context::with(|cx| { | 369 | 12 | // Prepare for blocking until a receiver wakes us up. | 370 | 12 | let oper = Operation::hook(token); | 371 | 12 | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | 12 | if !self.is_full() || self.is_disconnected()3 { | 375 | 9 | let _ = cx.try_select(Selected::Aborted); | 376 | 9 | }3 | 377 | | | 378 | | // Block the current thread. | 379 | 12 | let sel = cx.wait_until(deadline); | 380 | 12 | | 381 | 12 | match sel { | 382 | 12 | Selected::Waiting => unreachable!()0 , | 383 | 10 | Selected::Aborted | Selected::Disconnected => { | 384 | 10 | self.senders.unregister(oper).unwrap(); | 385 | 10 | } | 386 | 2 | Selected::Operation(_) => {} | 387 | | } | 388 | 12 | }); |
<crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Line | Count | Source | 368 | 5 | Context::with(|cx| { | 369 | 5 | // Prepare for blocking until a receiver wakes us up. | 370 | 5 | let oper = Operation::hook(token); | 371 | 5 | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | 5 | if !self.is_full() || self.is_disconnected()2 { | 375 | 3 | let _ = cx.try_select(Selected::Aborted); | 376 | 3 | }2 | 377 | | | 378 | | // Block the current thread. | 379 | 5 | let sel = cx.wait_until(deadline); | 380 | 5 | | 381 | 5 | match sel { | 382 | 5 | Selected::Waiting => unreachable!()0 , | 383 | 3 | Selected::Aborted | Selected::Disconnected => { | 384 | 3 | self.senders.unregister(oper).unwrap(); | 385 | 3 | } | 386 | 2 | Selected::Operation(_) => {} | 387 | | } | 388 | 5 | }); |
<crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Line | Count | Source | 368 | 2 | Context::with(|cx| { | 369 | 2 | // Prepare for blocking until a receiver wakes us up. | 370 | 2 | let oper = Operation::hook(token); | 371 | 2 | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | 2 | if !self.is_full() || self.is_disconnected() { | 375 | 0 | let _ = cx.try_select(Selected::Aborted); | 376 | 2 | } | 377 | | | 378 | | // Block the current thread. | 379 | 2 | let sel = cx.wait_until(deadline); | 380 | 2 | | 381 | 2 | match sel { | 382 | 2 | Selected::Waiting => unreachable!()0 , | 383 | 1 | Selected::Aborted | Selected::Disconnected => { | 384 | 1 | self.senders.unregister(oper).unwrap(); | 385 | 1 | } | 386 | 1 | Selected::Operation(_) => {} | 387 | | } | 388 | 2 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<bool>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::string::String>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i64>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Line | Count | Source | 368 | 17.0k | Context::with(|cx| { | 369 | 17.0k | // Prepare for blocking until a receiver wakes us up. | 370 | 17.0k | let oper = Operation::hook(token); | 371 | 17.0k | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | 17.0k | if !self.is_full() || self.is_disconnected()13.9k { | 375 | 3.12k | let _ = cx.try_select(Selected::Aborted); | 376 | 14.0k | } | 377 | | | 378 | | // Block the current thread. | 379 | 17.1k | let sel = cx.wait_until(deadline); | 380 | 17.1k | | 381 | 17.1k | match sel { | 382 | 17.1k | Selected::Waiting => unreachable!()88 , | 383 | 3.11k | Selected::Aborted | Selected::Disconnected => { | 384 | 3.11k | self.senders.unregister(oper).unwrap(); | 385 | 3.11k | } | 386 | 13.9k | Selected::Operation(_) => {} | 387 | | } | 388 | 17.0k | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<u8>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send::{closure#0} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send::{closure#0} |
389 | | } |
390 | 2.72M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send <crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 10.0k | pub(crate) fn send( | 341 | 10.0k | &self, | 342 | 10.0k | msg: T, | 343 | 10.0k | deadline: Option<Instant>, | 344 | 10.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 10.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 10.0k | let backoff = Backoff::new(); | 349 | 10.0k | loop { | 350 | 10.0k | if self.start_send(token) { | 351 | 10.0k | let res = unsafe { self.write(token, msg) }; | 352 | 10.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 397k | pub(crate) fn send( | 341 | 397k | &self, | 342 | 397k | msg: T, | 343 | 397k | deadline: Option<Instant>, | 344 | 397k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 397k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 397k | let backoff = Backoff::new(); | 349 | 400k | loop { | 350 | 400k | if self.start_send(token) { | 351 | 397k | let res = unsafe { self.write(token, msg) }; | 352 | 397k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 3.00k | } | 354 | 3.00k | | 355 | 3.00k | if backoff.is_completed() { | 356 | 134 | break; | 357 | 2.87k | } else { | 358 | 2.87k | backoff.snooze(); | 359 | 2.87k | } | 360 | | } | 361 | | | 362 | 134 | if let Some(d) = deadline { | 363 | 134 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 397k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::send Line | Count | Source | 340 | 10.0k | pub(crate) fn send( | 341 | 10.0k | &self, | 342 | 10.0k | msg: T, | 343 | 10.0k | deadline: Option<Instant>, | 344 | 10.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 10.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 10.0k | let backoff = Backoff::new(); | 349 | 10.0k | loop { | 350 | 10.0k | if self.start_send(token) { | 351 | 10.0k | let res = unsafe { self.write(token, msg) }; | 352 | 10.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::send Line | Count | Source | 340 | 59.4k | pub(crate) fn send( | 341 | 59.4k | &self, | 342 | 59.4k | msg: T, | 343 | 59.4k | deadline: Option<Instant>, | 344 | 59.4k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 59.4k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 59.4k | let backoff = Backoff::new(); | 349 | 59.4k | loop { | 350 | 59.4k | if self.start_send(token) { | 351 | 59.8k | let res = unsafe { self.write(token, msg) }; | 352 | 59.8k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 18.4E | } | 354 | 18.4E | | 355 | 18.4E | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 59.8k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::send Line | Count | Source | 340 | 1 | pub(crate) fn send( | 341 | 1 | &self, | 342 | 1 | msg: T, | 343 | 1 | deadline: Option<Instant>, | 344 | 1 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1 | let backoff = Backoff::new(); | 349 | 1 | loop { | 350 | 1 | if self.start_send(token) { | 351 | 1 | let res = unsafe { self.write(token, msg) }; | 352 | 1 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1 | } |
<crossbeam_channel::flavors::array::Channel<()>>::send Line | Count | Source | 340 | 10.0k | pub(crate) fn send( | 341 | 10.0k | &self, | 342 | 10.0k | msg: T, | 343 | 10.0k | deadline: Option<Instant>, | 344 | 10.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 10.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 10.0k | let backoff = Backoff::new(); | 349 | 10.0k | loop { | 350 | 10.0k | if self.start_send(token) { | 351 | 10.0k | let res = unsafe { self.write(token, msg) }; | 352 | 10.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::send Line | Count | Source | 340 | 1 | pub(crate) fn send( | 341 | 1 | &self, | 342 | 1 | msg: T, | 343 | 1 | deadline: Option<Instant>, | 344 | 1 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1 | let backoff = Backoff::new(); | 349 | 1 | loop { | 350 | 1 | if self.start_send(token) { | 351 | 1 | let res = unsafe { self.write(token, msg) }; | 352 | 1 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 11 | pub(crate) fn send( | 341 | 11 | &self, | 342 | 11 | msg: T, | 343 | 11 | deadline: Option<Instant>, | 344 | 11 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 11 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 11 | let backoff = Backoff::new(); | 349 | 18 | loop { | 350 | 18 | if self.start_send(token) { | 351 | 11 | let res = unsafe { self.write(token, msg) }; | 352 | 11 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 7 | } | 354 | 7 | | 355 | 7 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 7 | } else { | 358 | 7 | backoff.snooze(); | 359 | 7 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 11 | } |
<crossbeam_channel::flavors::array::Channel<()>>::send Line | Count | Source | 340 | 128k | pub(crate) fn send( | 341 | 128k | &self, | 342 | 128k | msg: T, | 343 | 128k | deadline: Option<Instant>, | 344 | 128k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 128k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 128k | let backoff = Backoff::new(); | 349 | 138k | loop { | 350 | 138k | if self.start_send(token) { | 351 | 129k | let res = unsafe { self.write(token, msg) }; | 352 | 129k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 9.13k | } | 354 | 9.13k | | 355 | 9.13k | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 10.6k | } else { | 358 | 10.6k | backoff.snooze(); | 359 | 10.6k | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d18.4E ) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 12 | } | 367 | | | 368 | 12 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 12 | }); | 389 | | } | 390 | 129k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send Line | Count | Source | 340 | 1.00k | pub(crate) fn send( | 341 | 1.00k | &self, | 342 | 1.00k | msg: T, | 343 | 1.00k | deadline: Option<Instant>, | 344 | 1.00k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1.00k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1.00k | let backoff = Backoff::new(); | 349 | 1.00k | loop { | 350 | 1.00k | if self.start_send(token) { | 351 | 1.00k | let res = unsafe { self.write(token, msg) }; | 352 | 1.00k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::send Line | Count | Source | 340 | 317k | pub(crate) fn send( | 341 | 317k | &self, | 342 | 317k | msg: T, | 343 | 317k | deadline: Option<Instant>, | 344 | 317k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 317k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 317k | let backoff = Backoff::new(); | 349 | 330k | loop { | 350 | 330k | if self.start_send(token) { | 351 | 327k | let res = unsafe { self.write(token, msg) }; | 352 | 327k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 2.18k | } | 354 | 2.18k | | 355 | 2.18k | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 12.7k | } else { | 358 | 12.7k | backoff.snooze(); | 359 | 12.7k | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d18.4E ) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 5 | } | 367 | | | 368 | 5 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 5 | }); | 389 | | } | 390 | 327k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::send Line | Count | Source | 340 | 493k | pub(crate) fn send( | 341 | 493k | &self, | 342 | 493k | msg: T, | 343 | 493k | deadline: Option<Instant>, | 344 | 493k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 493k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 493k | let backoff = Backoff::new(); | 349 | 498k | loop { | 350 | 498k | if self.start_send(token) { | 351 | 493k | let res = unsafe { self.write(token, msg) }; | 352 | 493k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 4.94k | } | 354 | 4.94k | | 355 | 4.94k | if backoff.is_completed() { | 356 | 0 | break; | 357 | 4.94k | } else { | 358 | 4.94k | backoff.snooze(); | 359 | 4.94k | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 493k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 109k | pub(crate) fn send( | 341 | 109k | &self, | 342 | 109k | msg: T, | 343 | 109k | deadline: Option<Instant>, | 344 | 109k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 109k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 109k | let backoff = Backoff::new(); | 349 | 109k | loop { | 350 | 109k | if self.start_send(token) { | 351 | 110k | let res = unsafe { self.write(token, msg) }; | 352 | 110k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 18.4E | } | 354 | 18.4E | | 355 | 18.4E | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 33 | } else { | 358 | 33 | backoff.snooze(); | 359 | 33 | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d18.4E ) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 1 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 1 | } | 366 | 1 | } | 367 | | | 368 | 2 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 2 | }); | 389 | | } | 390 | 110k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::send Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::send <crossbeam_channel::flavors::array::Channel<alloc::string::String>>::send Line | Count | Source | 340 | 1 | pub(crate) fn send( | 341 | 1 | &self, | 342 | 1 | msg: T, | 343 | 1 | deadline: Option<Instant>, | 344 | 1 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1 | let backoff = Backoff::new(); | 349 | 1 | loop { | 350 | 1 | if self.start_send(token) { | 351 | 1 | let res = unsafe { self.write(token, msg) }; | 352 | 1 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u8>>::send Line | Count | Source | 340 | 20.0k | pub(crate) fn send( | 341 | 20.0k | &self, | 342 | 20.0k | msg: T, | 343 | 20.0k | deadline: Option<Instant>, | 344 | 20.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 20.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 20.0k | let backoff = Backoff::new(); | 349 | 20.0k | loop { | 350 | 20.0k | if self.start_send(token) { | 351 | 20.0k | let res = unsafe { self.write(token, msg) }; | 352 | 20.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 20.0k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 638k | pub(crate) fn send( | 341 | 638k | &self, | 342 | 638k | msg: T, | 343 | 638k | deadline: Option<Instant>, | 344 | 638k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 638k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 655k | let backoff = Backoff::new(); | 349 | 1.15M | loop { | 350 | 1.15M | if self.start_send(token) { | 351 | 645k | let res = unsafe { self.write(token, msg) }; | 352 | 645k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 507k | } | 354 | 507k | | 355 | 507k | if backoff.is_completed() { | 356 | 10.1k | break; | 357 | 497k | } else { | 358 | 497k | backoff.snooze(); | 359 | 497k | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d) = deadline10.1k { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 17.1k | } | 367 | | | 368 | 17.1k | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 17.1k | }); | 389 | | } | 390 | 645k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::send Line | Count | Source | 340 | 1 | pub(crate) fn send( | 341 | 1 | &self, | 342 | 1 | msg: T, | 343 | 1 | deadline: Option<Instant>, | 344 | 1 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1 | let backoff = Backoff::new(); | 349 | 1 | loop { | 350 | 1 | if self.start_send(token) { | 351 | 1 | let res = unsafe { self.write(token, msg) }; | 352 | 1 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::send Line | Count | Source | 340 | 2.00k | pub(crate) fn send( | 341 | 2.00k | &self, | 342 | 2.00k | msg: T, | 343 | 2.00k | deadline: Option<Instant>, | 344 | 2.00k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 2.00k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 2.00k | let backoff = Backoff::new(); | 349 | 2.00k | loop { | 350 | 2.00k | if self.start_send(token) { | 351 | 2.00k | let res = unsafe { self.write(token, msg) }; | 352 | 2.00k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 18.4E | } | 354 | 18.4E | | 355 | 18.4E | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::send Line | Count | Source | 340 | 1 | pub(crate) fn send( | 341 | 1 | &self, | 342 | 1 | msg: T, | 343 | 1 | deadline: Option<Instant>, | 344 | 1 | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1 | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1 | let backoff = Backoff::new(); | 349 | 1 | loop { | 350 | 1 | if self.start_send(token) { | 351 | 1 | let res = unsafe { self.write(token, msg) }; | 352 | 1 | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::send Line | Count | Source | 340 | 1.00k | pub(crate) fn send( | 341 | 1.00k | &self, | 342 | 1.00k | msg: T, | 343 | 1.00k | deadline: Option<Instant>, | 344 | 1.00k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 1.00k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 1.00k | let backoff = Backoff::new(); | 349 | 1.55k | loop { | 350 | 1.55k | if self.start_send(token) { | 351 | 1.00k | let res = unsafe { self.write(token, msg) }; | 352 | 1.00k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 559 | } | 354 | 559 | | 355 | 559 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 559 | } else { | 358 | 559 | backoff.snooze(); | 359 | 559 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::send Line | Count | Source | 340 | 10.0k | pub(crate) fn send( | 341 | 10.0k | &self, | 342 | 10.0k | msg: T, | 343 | 10.0k | deadline: Option<Instant>, | 344 | 10.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 10.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 10.0k | let backoff = Backoff::new(); | 349 | 10.0k | loop { | 350 | 10.0k | if self.start_send(token) { | 351 | 10.0k | let res = unsafe { self.write(token, msg) }; | 352 | 10.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::send Line | Count | Source | 340 | 59.7k | pub(crate) fn send( | 341 | 59.7k | &self, | 342 | 59.7k | msg: T, | 343 | 59.7k | deadline: Option<Instant>, | 344 | 59.7k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 59.7k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 59.7k | let backoff = Backoff::new(); | 349 | 59.7k | loop { | 350 | 59.7k | if self.start_send(token) { | 351 | 59.8k | let res = unsafe { self.write(token, msg) }; | 352 | 59.8k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 18.4E | } | 354 | 18.4E | | 355 | 18.4E | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 59.8k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::send Line | Count | Source | 340 | 394k | pub(crate) fn send( | 341 | 394k | &self, | 342 | 394k | msg: T, | 343 | 394k | deadline: Option<Instant>, | 344 | 394k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 394k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 394k | let backoff = Backoff::new(); | 349 | 399k | loop { | 350 | 399k | if self.start_send(token) { | 351 | 394k | let res = unsafe { self.write(token, msg) }; | 352 | 394k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 4.78k | } | 354 | 4.78k | | 355 | 4.78k | if backoff.is_completed() { | 356 | 397 | break; | 357 | 4.38k | } else { | 358 | 4.38k | backoff.snooze(); | 359 | 4.38k | } | 360 | | } | 361 | | | 362 | 397 | if let Some(d) = deadline { | 363 | 397 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 394k | } |
<crossbeam_channel::flavors::array::Channel<()>>::send Line | Count | Source | 340 | 29.6k | pub(crate) fn send( | 341 | 29.6k | &self, | 342 | 29.6k | msg: T, | 343 | 29.6k | deadline: Option<Instant>, | 344 | 29.6k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 29.6k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 29.6k | let backoff = Backoff::new(); | 349 | 29.6k | loop { | 350 | 29.6k | if self.start_send(token) { | 351 | 29.9k | let res = unsafe { self.write(token, msg) }; | 352 | 29.9k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 18.4E | } | 354 | 18.4E | | 355 | 18.4E | if backoff.is_completed() { | 356 | 18.4E | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 18.4E | if let Some(d) = deadline { | 363 | 18.4E | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 29.9k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::send <crossbeam_channel::flavors::array::Channel<usize>>::send Line | Count | Source | 340 | 10.0k | pub(crate) fn send( | 341 | 10.0k | &self, | 342 | 10.0k | msg: T, | 343 | 10.0k | deadline: Option<Instant>, | 344 | 10.0k | ) -> Result<(), SendTimeoutError<T>> { | 345 | 10.0k | let token = &mut Token::default(); | 346 | | loop { | 347 | | // Try sending a message several times. | 348 | 10.0k | let backoff = Backoff::new(); | 349 | 10.0k | loop { | 350 | 10.0k | if self.start_send(token) { | 351 | 10.0k | let res = unsafe { self.write(token, msg) }; | 352 | 10.0k | return res.map_err(SendTimeoutError::Disconnected); | 353 | 0 | } | 354 | 0 |
| 355 | 0 | if backoff.is_completed() { | 356 | 0 | break; | 357 | 0 | } else { | 358 | 0 | backoff.snooze(); | 359 | 0 | } | 360 | | } | 361 | | | 362 | 0 | if let Some(d) = deadline { | 363 | 0 | if Instant::now() >= d { | 364 | 0 | return Err(SendTimeoutError::Timeout(msg)); | 365 | 0 | } | 366 | 0 | } | 367 | | | 368 | 0 | Context::with(|cx| { | 369 | | // Prepare for blocking until a receiver wakes us up. | 370 | | let oper = Operation::hook(token); | 371 | | self.senders.register(oper, cx); | 372 | | | 373 | | // Has the channel become ready just now? | 374 | | if !self.is_full() || self.is_disconnected() { | 375 | | let _ = cx.try_select(Selected::Aborted); | 376 | | } | 377 | | | 378 | | // Block the current thread. | 379 | | let sel = cx.wait_until(deadline); | 380 | | | 381 | | match sel { | 382 | | Selected::Waiting => unreachable!(), | 383 | | Selected::Aborted | Selected::Disconnected => { | 384 | | self.senders.unregister(oper).unwrap(); | 385 | | } | 386 | | Selected::Operation(_) => {} | 387 | | } | 388 | 0 | }); | 389 | | } | 390 | 10.0k | } |
|
391 | | |
392 | | /// Attempts to receive a message without blocking. |
393 | 1.15M | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { |
394 | 1.15M | let token = &mut Token::default(); |
395 | 1.15M | |
396 | 1.15M | if self.start_recv(token) { |
397 | 660k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected1.18k ) } <crossbeam_channel::flavors::array::Channel<i32>>::try_recv::{closure#0} Line | Count | Source | 397 | 2 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } |
<crossbeam_channel::flavors::array::Channel<i32>>::try_recv::{closure#0} Line | Count | Source | 397 | 1 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } |
<crossbeam_channel::flavors::array::Channel<i32>>::try_recv::{closure#0} Line | Count | Source | 397 | 1.18k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } |
|
398 | | } else { |
399 | 493k | Err(TryRecvError::Empty) |
400 | | } |
401 | 1.15M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::try_recv <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Line | Count | Source | 393 | 396k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 396k | let token = &mut Token::default(); | 395 | 396k | | 396 | 396k | if self.start_recv(token) { | 397 | 199k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 196k | Err(TryRecvError::Empty) | 400 | | } | 401 | 396k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::try_recv <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Line | Count | Source | 393 | 8 | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 8 | let token = &mut Token::default(); | 395 | 8 | | 396 | 8 | if self.start_recv(token) { | 397 | 5 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 3 | Err(TryRecvError::Empty) | 400 | | } | 401 | 8 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::try_recv <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Line | Count | Source | 393 | 99.6k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 99.6k | let token = &mut Token::default(); | 395 | 99.6k | | 396 | 99.6k | if self.start_recv(token) { | 397 | 100k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 18.4E | Err(TryRecvError::Empty) | 400 | | } | 401 | 99.6k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::try_recv Line | Count | Source | 393 | 200k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 200k | let token = &mut Token::default(); | 395 | 200k | | 396 | 200k | if self.start_recv(token) { | 397 | 100k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 100k | Err(TryRecvError::Empty) | 400 | | } | 401 | 200k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_recv <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Line | Count | Source | 393 | 3.79k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 3.79k | let token = &mut Token::default(); | 395 | 3.79k | | 396 | 3.79k | if self.start_recv(token) { | 397 | 3.17k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 625 | Err(TryRecvError::Empty) | 400 | | } | 401 | 3.79k | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::try_recv Line | Count | Source | 393 | 2 | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 2 | let token = &mut Token::default(); | 395 | 2 | | 396 | 2 | if self.start_recv(token) { | 397 | 1 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 1 | Err(TryRecvError::Empty) | 400 | | } | 401 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i64>>::try_recv Line | Count | Source | 393 | 2 | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 2 | let token = &mut Token::default(); | 395 | 2 | | 396 | 2 | if self.start_recv(token) { | 397 | 1 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 1 | Err(TryRecvError::Empty) | 400 | | } | 401 | 2 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::try_recv Line | Count | Source | 393 | 2 | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 2 | let token = &mut Token::default(); | 395 | 2 | | 396 | 2 | if self.start_recv(token) { | 397 | 1 | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 1 | Err(TryRecvError::Empty) | 400 | | } | 401 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::try_recv <crossbeam_channel::flavors::array::Channel<i32>>::try_recv Line | Count | Source | 393 | 396k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 396k | let token = &mut Token::default(); | 395 | 396k | | 396 | 396k | if self.start_recv(token) { | 397 | 199k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 196k | Err(TryRecvError::Empty) | 400 | | } | 401 | 396k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::try_recv Line | Count | Source | 393 | 3.00k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 3.00k | let token = &mut Token::default(); | 395 | 3.00k | | 396 | 3.00k | if self.start_recv(token) { | 397 | 3.00k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 0 | Err(TryRecvError::Empty) | 400 | | } | 401 | 3.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::try_recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::try_recv <crossbeam_channel::flavors::array::Channel<usize>>::try_recv Line | Count | Source | 393 | 10.0k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 10.0k | let token = &mut Token::default(); | 395 | 10.0k | | 396 | 10.0k | if self.start_recv(token) { | 397 | 10.0k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 0 | Err(TryRecvError::Empty) | 400 | | } | 401 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::try_recv Line | Count | Source | 393 | 44.4k | pub(crate) fn try_recv(&self) -> Result<T, TryRecvError> { | 394 | 44.4k | let token = &mut Token::default(); | 395 | 44.4k | | 396 | 44.4k | if self.start_recv(token) { | 397 | 44.4k | unsafe { self.read(token).map_err(|_| TryRecvError::Disconnected) } | 398 | | } else { | 399 | 18.4E | Err(TryRecvError::Empty) | 400 | | } | 401 | 44.4k | } |
|
402 | | |
403 | | /// Receives a message from the channel. |
404 | 1.58M | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { |
405 | 1.58M | let token = &mut Token::default(); |
406 | | loop { |
407 | | // Try receiving a message several times. |
408 | 1.60M | let backoff = Backoff::new(); |
409 | 2.75M | loop { |
410 | 2.75M | if self.start_recv(token) { |
411 | 1.59M | let res = unsafe { self.read(token) }; |
412 | 1.59M | return res.map_err(|_| RecvTimeoutError::Disconnected247 ); <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#0} Line | Count | Source | 412 | 3 | return res.map_err(|_| RecvTimeoutError::Disconnected); |
<crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#0} Line | Count | Source | 412 | 2 | return res.map_err(|_| RecvTimeoutError::Disconnected); |
<crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#0} Line | Count | Source | 412 | 1 | return res.map_err(|_| RecvTimeoutError::Disconnected); |
<crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#0} Line | Count | Source | 412 | 241 | return res.map_err(|_| RecvTimeoutError::Disconnected); |
|
413 | 1.15M | } |
414 | 1.15M | |
415 | 1.15M | if backoff.is_completed() { |
416 | 9.40k | break; |
417 | 1.14M | } else { |
418 | 1.14M | backoff.snooze(); |
419 | 1.14M | } |
420 | | } |
421 | | |
422 | 18.4E | if let Some(d) = deadline9.40k { |
423 | 18.4E | if Instant::now() >= d { |
424 | 3 | return Err(RecvTimeoutError::Timeout); |
425 | 5 | } |
426 | 23.1k | } |
427 | | |
428 | 23.1k | Context::with(|cx| { |
429 | 23.1k | // Prepare for blocking until a sender wakes us up. |
430 | 23.1k | let oper = Operation::hook(token); |
431 | 23.1k | self.receivers.register(oper, cx); |
432 | | |
433 | | // Has the channel become ready just now? |
434 | 23.1k | if !self.is_empty() || self.is_disconnected()17.5k { |
435 | 5.56k | let _ = cx.try_select(Selected::Aborted); |
436 | 17.6k | } |
437 | | |
438 | | // Block the current thread. |
439 | 23.2k | let sel = cx.wait_until(deadline); |
440 | 23.2k | |
441 | 23.2k | match sel { |
442 | 23.2k | Selected::Waiting => unreachable!()67 , |
443 | 5.55k | Selected::Aborted | Selected::Disconnected => { |
444 | 5.55k | self.receivers.unregister(oper).unwrap(); |
445 | 5.55k | // If the channel was disconnected, we still have to check for remaining |
446 | 5.55k | // messages. |
447 | 5.55k | } |
448 | 17.6k | Selected::Operation(_) => {} |
449 | | } |
450 | 23.1k | })23.1k ; Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Line | Count | Source | 428 | 486 | Context::with(|cx| { | 429 | 486 | // Prepare for blocking until a sender wakes us up. | 430 | 486 | let oper = Operation::hook(token); | 431 | 486 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 486 | if !self.is_empty() || self.is_disconnected()79 { | 435 | 407 | let _ = cx.try_select(Selected::Aborted); | 436 | 407 | }79 | 437 | | | 438 | | // Block the current thread. | 439 | 486 | let sel = cx.wait_until(deadline); | 440 | 486 | | 441 | 486 | match sel { | 442 | 486 | Selected::Waiting => unreachable!()0 , | 443 | 407 | Selected::Aborted | Selected::Disconnected => { | 444 | 407 | self.receivers.unregister(oper).unwrap(); | 445 | 407 | // If the channel was disconnected, we still have to check for remaining | 446 | 407 | // messages. | 447 | 407 | } | 448 | 79 | Selected::Operation(_) => {} | 449 | | } | 450 | 486 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Line | Count | Source | 428 | 14 | Context::with(|cx| { | 429 | 14 | // Prepare for blocking until a sender wakes us up. | 430 | 14 | let oper = Operation::hook(token); | 431 | 14 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 14 | if !self.is_empty() || self.is_disconnected()3 { | 435 | 11 | let _ = cx.try_select(Selected::Aborted); | 436 | 11 | }3 | 437 | | | 438 | | // Block the current thread. | 439 | 14 | let sel = cx.wait_until(deadline); | 440 | 14 | | 441 | 14 | match sel { | 442 | 14 | Selected::Waiting => unreachable!()0 , | 443 | 12 | Selected::Aborted | Selected::Disconnected => { | 444 | 12 | self.receivers.unregister(oper).unwrap(); | 445 | 12 | // If the channel was disconnected, we still have to check for remaining | 446 | 12 | // messages. | 447 | 12 | } | 448 | 2 | Selected::Operation(_) => {} | 449 | | } | 450 | 14 | }); |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::recv::{closure#1} Line | Count | Source | 428 | 21 | Context::with(|cx| { | 429 | 21 | // Prepare for blocking until a sender wakes us up. | 430 | 21 | let oper = Operation::hook(token); | 431 | 21 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 21 | if !self.is_empty() || self.is_disconnected()4 { | 435 | 17 | let _ = cx.try_select(Selected::Aborted); | 436 | 17 | }4 | 437 | | | 438 | | // Block the current thread. | 439 | 21 | let sel = cx.wait_until(deadline); | 440 | 21 | | 441 | 21 | match sel { | 442 | 21 | Selected::Waiting => unreachable!()0 , | 443 | 17 | Selected::Aborted | Selected::Disconnected => { | 444 | 17 | self.receivers.unregister(oper).unwrap(); | 445 | 17 | // If the channel was disconnected, we still have to check for remaining | 446 | 17 | // messages. | 447 | 17 | } | 448 | 4 | Selected::Operation(_) => {} | 449 | | } | 450 | 21 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Line | Count | Source | 428 | 641 | Context::with(|cx| { | 429 | 641 | // Prepare for blocking until a sender wakes us up. | 430 | 641 | let oper = Operation::hook(token); | 431 | 641 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 641 | if !self.is_empty() || self.is_disconnected()110 { | 435 | 531 | let _ = cx.try_select(Selected::Aborted); | 436 | 531 | }110 | 437 | | | 438 | | // Block the current thread. | 439 | 641 | let sel = cx.wait_until(deadline); | 440 | 641 | | 441 | 641 | match sel { | 442 | 641 | Selected::Waiting => unreachable!()1 , | 443 | 533 | Selected::Aborted | Selected::Disconnected => { | 444 | 533 | self.receivers.unregister(oper).unwrap(); | 445 | 533 | // If the channel was disconnected, we still have to check for remaining | 446 | 533 | // messages. | 447 | 533 | } | 448 | 107 | Selected::Operation(_) => {} | 449 | | } | 450 | 640 | }); |
<crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Line | Count | Source | 428 | 2 | Context::with(|cx| { | 429 | 2 | // Prepare for blocking until a sender wakes us up. | 430 | 2 | let oper = Operation::hook(token); | 431 | 2 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 2 | if !self.is_empty() || self.is_disconnected() { | 435 | 0 | let _ = cx.try_select(Selected::Aborted); | 436 | 2 | } | 437 | | | 438 | | // Block the current thread. | 439 | 2 | let sel = cx.wait_until(deadline); | 440 | 2 | | 441 | 2 | match sel { | 442 | 2 | Selected::Waiting => unreachable!()0 , | 443 | 0 | Selected::Aborted | Selected::Disconnected => { | 444 | 0 | self.receivers.unregister(oper).unwrap(); | 445 | 0 | // If the channel was disconnected, we still have to check for remaining | 446 | 0 | // messages. | 447 | 0 | } | 448 | 2 | Selected::Operation(_) => {} | 449 | | } | 450 | 2 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Line | Count | Source | 428 | 21.8k | Context::with(|cx| { | 429 | 21.8k | // Prepare for blocking until a sender wakes us up. | 430 | 21.8k | let oper = Operation::hook(token); | 431 | 21.8k | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 21.8k | if !self.is_empty() || self.is_disconnected()17.2k { | 435 | 4.58k | let _ = cx.try_select(Selected::Aborted); | 436 | 17.3k | } | 437 | | | 438 | | // Block the current thread. | 439 | 21.9k | let sel = cx.wait_until(deadline); | 440 | 21.9k | | 441 | 21.9k | match sel { | 442 | 21.9k | Selected::Waiting => unreachable!()57 , | 443 | 4.58k | Selected::Aborted | Selected::Disconnected => { | 444 | 4.58k | self.receivers.unregister(oper).unwrap(); | 445 | 4.58k | // If the channel was disconnected, we still have to check for remaining | 446 | 4.58k | // messages. | 447 | 4.58k | } | 448 | 17.3k | Selected::Operation(_) => {} | 449 | | } | 450 | 21.9k | }); |
<crossbeam_channel::flavors::array::Channel<bool>>::recv::{closure#1} Line | Count | Source | 428 | 1 | Context::with(|cx| { | 429 | 1 | // Prepare for blocking until a sender wakes us up. | 430 | 1 | let oper = Operation::hook(token); | 431 | 1 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 1 | if !self.is_empty() || self.is_disconnected()0 { | 435 | 1 | let _ = cx.try_select(Selected::Aborted); | 436 | 1 | }0 | 437 | | | 438 | | // Block the current thread. | 439 | 1 | let sel = cx.wait_until(deadline); | 440 | 1 | | 441 | 1 | match sel { | 442 | 1 | Selected::Waiting => unreachable!()0 , | 443 | 1 | Selected::Aborted | Selected::Disconnected => { | 444 | 1 | self.receivers.unregister(oper).unwrap(); | 445 | 1 | // If the channel was disconnected, we still have to check for remaining | 446 | 1 | // messages. | 447 | 1 | } | 448 | 0 | Selected::Operation(_) => {} | 449 | | } | 450 | 1 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<u8>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<u32>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Line | Count | Source | 428 | 97 | Context::with(|cx| { | 429 | 97 | // Prepare for blocking until a sender wakes us up. | 430 | 97 | let oper = Operation::hook(token); | 431 | 97 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 97 | if !self.is_empty() || self.is_disconnected()96 { | 435 | 1 | let _ = cx.try_select(Selected::Aborted); | 436 | 95 | } | 437 | | | 438 | | // Block the current thread. | 439 | 96 | let sel = cx.wait_until(deadline); | 440 | 96 | | 441 | 96 | match sel { | 442 | 96 | Selected::Waiting => unreachable!()9 , | 443 | 1 | Selected::Aborted | Selected::Disconnected => { | 444 | 1 | self.receivers.unregister(oper).unwrap(); | 445 | 1 | // If the channel was disconnected, we still have to check for remaining | 446 | 1 | // messages. | 447 | 1 | } | 448 | 86 | Selected::Operation(_) => {} | 449 | | } | 450 | 87 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::string::String>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i64>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} Line | Count | Source | 428 | 4 | Context::with(|cx| { | 429 | 4 | // Prepare for blocking until a sender wakes us up. | 430 | 4 | let oper = Operation::hook(token); | 431 | 4 | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | 4 | if !self.is_empty() || self.is_disconnected()1 { | 435 | 3 | let _ = cx.try_select(Selected::Aborted); | 436 | 3 | }1 | 437 | | | 438 | | // Block the current thread. | 439 | 4 | let sel = cx.wait_until(deadline); | 440 | 4 | | 441 | 4 | match sel { | 442 | 4 | Selected::Waiting => unreachable!()0 , | 443 | 3 | Selected::Aborted | Selected::Disconnected => { | 444 | 3 | self.receivers.unregister(oper).unwrap(); | 445 | 3 | // If the channel was disconnected, we still have to check for remaining | 446 | 3 | // messages. | 447 | 3 | } | 448 | 1 | Selected::Operation(_) => {} | 449 | | } | 450 | 4 | }); |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv::{closure#1} Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv::{closure#1} |
451 | | } |
452 | 1.59M | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv <crossbeam_channel::flavors::array::Channel<i32>>::recv Line | Count | Source | 404 | 10.0k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 10.0k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 10.4k | let backoff = Backoff::new(); | 409 | 83.0k | loop { | 410 | 83.0k | if self.start_recv(token) { | 411 | 10.0k | let res = unsafe { self.read(token) }; | 412 | 10.0k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 73.0k | } | 414 | 73.0k | | 415 | 73.0k | if backoff.is_completed() { | 416 | 486 | break; | 417 | 72.6k | } else { | 418 | 72.6k | backoff.snooze(); | 419 | 72.6k | } | 420 | | } | 421 | | | 422 | 486 | if let Some(d0 ) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 486 | } | 427 | | | 428 | 486 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 486 | }); | 451 | | } | 452 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::recv <crossbeam_channel::flavors::array::Channel<()>>::recv Line | Count | Source | 404 | 49.4k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 49.4k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 49.4k | let backoff = Backoff::new(); | 409 | 104k | loop { | 410 | 104k | if self.start_recv(token) { | 411 | 49.8k | let res = unsafe { self.read(token) }; | 412 | 49.8k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 55.0k | } | 414 | 55.0k | | 415 | 55.0k | if backoff.is_completed() { | 416 | 18.4E | break; | 417 | 55.3k | } else { | 418 | 55.3k | backoff.snooze(); | 419 | 55.3k | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d) = deadline { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 49.8k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::recv Line | Count | Source | 404 | 1 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1 | let backoff = Backoff::new(); | 409 | 1 | loop { | 410 | 1 | if self.start_recv(token) { | 411 | 1 | let res = unsafe { self.read(token) }; | 412 | 1 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 0 | } | 414 | 0 |
| 415 | 0 | if backoff.is_completed() { | 416 | 0 | break; | 417 | 0 | } else { | 418 | 0 | backoff.snooze(); | 419 | 0 | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::recv <crossbeam_channel::flavors::array::Channel<()>>::recv Line | Count | Source | 404 | 10.1k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 10.1k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 10.1k | let backoff = Backoff::new(); | 409 | 10.9k | loop { | 410 | 10.9k | if self.start_recv(token) { | 411 | 10.1k | let res = unsafe { self.read(token) }; | 412 | 10.1k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 758 | } | 414 | 758 | | 415 | 758 | if backoff.is_completed() { | 416 | 18.4E | break; | 417 | 771 | } else { | 418 | 771 | backoff.snooze(); | 419 | 771 | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d) = deadline { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 10.1k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::recv Line | Count | Source | 404 | 8 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 8 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 8 | let backoff = Backoff::new(); | 409 | 19 | loop { | 410 | 19 | if self.start_recv(token) { | 411 | 7 | let res = unsafe { self.read(token) }; | 412 | 7 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 12 | } | 414 | 12 | | 415 | 12 | if backoff.is_completed() { | 416 | 1 | break; | 417 | 11 | } else { | 418 | 11 | backoff.snooze(); | 419 | 11 | } | 420 | | } | 421 | | | 422 | 1 | if let Some(d) = deadline { | 423 | 1 | if Instant::now() >= d { | 424 | 1 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 8 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv Line | Count | Source | 404 | 1.00k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1.00k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1.00k | let backoff = Backoff::new(); | 409 | 4.05k | loop { | 410 | 4.05k | if self.start_recv(token) { | 411 | 1.00k | let res = unsafe { self.read(token) }; | 412 | 1.00k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 3.05k | } | 414 | 3.05k | | 415 | 3.05k | if backoff.is_completed() { | 416 | 0 | break; | 417 | 3.05k | } else { | 418 | 3.05k | backoff.snooze(); | 419 | 3.05k | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::recv Line | Count | Source | 404 | 220k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 220k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 220k | let backoff = Backoff::new(); | 409 | 227k | loop { | 410 | 227k | if self.start_recv(token) { | 411 | 227k | let res = unsafe { self.read(token) }; | 412 | 227k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 18.4E | } | 414 | 18.4E | | 415 | 18.4E | if backoff.is_completed() { | 416 | 18.4E | break; | 417 | 6.99k | } else { | 418 | 6.99k | backoff.snooze(); | 419 | 6.99k | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d) = deadline { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 2 | } | 426 | 0 | } | 427 | | | 428 | 2 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 2 | }); | 451 | | } | 452 | 227k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::recv Line | Count | Source | 404 | 490k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 490k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 490k | let backoff = Backoff::new(); | 409 | 492k | loop { | 410 | 492k | if self.start_recv(token) { | 411 | 490k | let res = unsafe { self.read(token) }; | 412 | 490k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 1.91k | } | 414 | 1.91k | | 415 | 1.91k | if backoff.is_completed() { | 416 | 21 | break; | 417 | 1.89k | } else { | 418 | 1.89k | backoff.snooze(); | 419 | 1.89k | } | 420 | | } | 421 | | | 422 | 21 | if let Some(d0 ) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 21 | } | 427 | | | 428 | 21 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 21 | }); | 451 | | } | 452 | 490k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::recv Line | Count | Source | 404 | 10.0k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 10.0k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 10.6k | let backoff = Backoff::new(); | 409 | 81.5k | loop { | 410 | 81.5k | if self.start_recv(token) { | 411 | 10.0k | let res = unsafe { self.read(token) }; | 412 | 10.0k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 71.5k | } | 414 | 71.5k | | 415 | 71.5k | if backoff.is_completed() { | 416 | 644 | break; | 417 | 70.8k | } else { | 418 | 70.8k | backoff.snooze(); | 419 | 70.8k | } | 420 | | } | 421 | | | 422 | 644 | if let Some(d6 ) = deadline { | 423 | 6 | if Instant::now() >= d { | 424 | 2 | return Err(RecvTimeoutError::Timeout); | 425 | 3 | } | 426 | 638 | } | 427 | | | 428 | 641 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 641 | }); | 451 | | } | 452 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::recv Line | Count | Source | 404 | 100k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 100k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 100k | let backoff = Backoff::new(); | 409 | 180k | loop { | 410 | 180k | if self.start_recv(token) { | 411 | 100k | let res = unsafe { self.read(token) }; | 412 | 100k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 80.4k | } | 414 | 80.4k | | 415 | 80.4k | if backoff.is_completed() { | 416 | 14 | break; | 417 | 80.4k | } else { | 418 | 80.4k | backoff.snooze(); | 419 | 80.4k | } | 420 | | } | 421 | | | 422 | 14 | if let Some(d0 ) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 14 | } | 427 | | | 428 | 14 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 14 | }); | 451 | | } | 452 | 100k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::recv <crossbeam_channel::flavors::array::Channel<bool>>::recv Line | Count | Source | 404 | 1.99k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1.99k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1.99k | let backoff = Backoff::new(); | 409 | 16.3k | loop { | 410 | 16.3k | if self.start_recv(token) { | 411 | 2.00k | let res = unsafe { self.read(token) }; | 412 | 2.00k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 14.3k | } | 414 | 14.3k | | 415 | 14.3k | if backoff.is_completed() { | 416 | 18.4E | break; | 417 | 14.3k | } else { | 418 | 14.3k | backoff.snooze(); | 419 | 14.3k | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d18.4E ) = deadline { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 1 | } | 427 | | | 428 | 1 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 1 | }); | 451 | | } | 452 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i64>>::recv Line | Count | Source | 404 | 1 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1 | let backoff = Backoff::new(); | 409 | 1 | loop { | 410 | 1 | if self.start_recv(token) { | 411 | 1 | let res = unsafe { self.read(token) }; | 412 | 1 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 0 | } | 414 | 0 |
| 415 | 0 | if backoff.is_completed() { | 416 | 0 | break; | 417 | 0 | } else { | 418 | 0 | backoff.snooze(); | 419 | 0 | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 1 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::recv Line | Count | Source | 404 | 1.01k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1.01k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1.10k | let backoff = Backoff::new(); | 409 | 3.63k | loop { | 410 | 3.63k | if self.start_recv(token) { | 411 | 1.00k | let res = unsafe { self.read(token) }; | 412 | 1.00k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 2.63k | } | 414 | 2.63k | | 415 | 2.63k | if backoff.is_completed() { | 416 | 107 | break; | 417 | 2.52k | } else { | 418 | 2.52k | backoff.snooze(); | 419 | 2.52k | } | 420 | | } | 421 | | | 422 | 107 | if let Some(d10 ) = deadline { | 423 | 10 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 97 | } | 427 | | | 428 | 97 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 97 | }); | 451 | | } | 452 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::recv Line | Count | Source | 404 | 1 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 1 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 1 | let backoff = Backoff::new(); | 409 | 1 | loop { | 410 | 1 | if self.start_recv(token) { | 411 | 1 | let res = unsafe { self.read(token) }; | 412 | 1 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 0 | } | 414 | 0 |
| 415 | 0 | if backoff.is_completed() { | 416 | 0 | break; | 417 | 0 | } else { | 418 | 0 | backoff.snooze(); | 419 | 0 | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<u8>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::recv <crossbeam_channel::flavors::array::Channel<i32>>::recv Line | Count | Source | 404 | 627k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 627k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 649k | let backoff = Backoff::new(); | 409 | 1.41M | loop { | 410 | 1.41M | if self.start_recv(token) { | 411 | 632k | let res = unsafe { self.read(token) }; | 412 | 632k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 780k | } | 414 | 780k | | 415 | 780k | if backoff.is_completed() { | 416 | 16.1k | break; | 417 | 764k | } else { | 418 | 764k | backoff.snooze(); | 419 | 764k | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d) = deadline16.1k { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 21.8k | } | 427 | | | 428 | 21.8k | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 21.8k | }); | 451 | | } | 452 | 632k | } |
<crossbeam_channel::flavors::array::Channel<u32>>::recv Line | Count | Source | 404 | 2 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 2 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 2 | let backoff = Backoff::new(); | 409 | 2 | loop { | 410 | 2 | if self.start_recv(token) { | 411 | 2 | let res = unsafe { self.read(token) }; | 412 | 2 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 0 | } | 414 | 0 |
| 415 | 0 | if backoff.is_completed() { | 416 | 0 | break; | 417 | 0 | } else { | 418 | 0 | backoff.snooze(); | 419 | 0 | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::recv Line | Count | Source | 404 | 2.00k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 2.00k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 2.00k | let backoff = Backoff::new(); | 409 | 9.80k | loop { | 410 | 9.80k | if self.start_recv(token) { | 411 | 2.00k | let res = unsafe { self.read(token) }; | 412 | 2.00k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 7.80k | } | 414 | 7.80k | | 415 | 7.80k | if backoff.is_completed() { | 416 | 0 | break; | 417 | 7.80k | } else { | 418 | 7.80k | backoff.snooze(); | 419 | 7.80k | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 2.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv <crossbeam_channel::flavors::array::Channel<usize>>::recv Line | Count | Source | 404 | 20 | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 20 | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 20 | let backoff = Backoff::new(); | 409 | 50 | loop { | 410 | 50 | if self.start_recv(token) { | 411 | 20 | let res = unsafe { self.read(token) }; | 412 | 20 | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 30 | } | 414 | 30 | | 415 | 30 | if backoff.is_completed() { | 416 | 0 | break; | 417 | 30 | } else { | 418 | 30 | backoff.snooze(); | 419 | 30 | } | 420 | | } | 421 | | | 422 | 0 | if let Some(d) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 20 | } |
<crossbeam_channel::flavors::array::Channel<()>>::recv Line | Count | Source | 404 | 40.0k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 40.0k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 40.0k | let backoff = Backoff::new(); | 409 | 103k | loop { | 410 | 103k | if self.start_recv(token) { | 411 | 40.0k | let res = unsafe { self.read(token) }; | 412 | 40.0k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 63.7k | } | 414 | 63.7k | | 415 | 63.7k | if backoff.is_completed() { | 416 | 4 | break; | 417 | 63.6k | } else { | 418 | 63.6k | backoff.snooze(); | 419 | 63.6k | } | 420 | | } | 421 | | | 422 | 4 | if let Some(d0 ) = deadline { | 423 | 0 | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 4 | } | 427 | | | 428 | 4 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 4 | }); | 451 | | } | 452 | 40.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::recv Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::recv <crossbeam_channel::flavors::array::Channel<()>>::recv Line | Count | Source | 404 | 19.8k | pub(crate) fn recv(&self, deadline: Option<Instant>) -> Result<T, RecvTimeoutError> { | 405 | 19.8k | let token = &mut Token::default(); | 406 | | loop { | 407 | | // Try receiving a message several times. | 408 | 19.8k | let backoff = Backoff::new(); | 409 | 22.4k | loop { | 410 | 22.4k | if self.start_recv(token) { | 411 | 19.9k | let res = unsafe { self.read(token) }; | 412 | 19.9k | return res.map_err(|_| RecvTimeoutError::Disconnected); | 413 | 2.49k | } | 414 | 2.49k | | 415 | 2.49k | if backoff.is_completed() { | 416 | 18.4E | break; | 417 | 2.61k | } else { | 418 | 2.61k | backoff.snooze(); | 419 | 2.61k | } | 420 | | } | 421 | | | 422 | 18.4E | if let Some(d) = deadline { | 423 | 18.4E | if Instant::now() >= d { | 424 | 0 | return Err(RecvTimeoutError::Timeout); | 425 | 0 | } | 426 | 0 | } | 427 | | | 428 | 0 | Context::with(|cx| { | 429 | | // Prepare for blocking until a sender wakes us up. | 430 | | let oper = Operation::hook(token); | 431 | | self.receivers.register(oper, cx); | 432 | | | 433 | | // Has the channel become ready just now? | 434 | | if !self.is_empty() || self.is_disconnected() { | 435 | | let _ = cx.try_select(Selected::Aborted); | 436 | | } | 437 | | | 438 | | // Block the current thread. | 439 | | let sel = cx.wait_until(deadline); | 440 | | | 441 | | match sel { | 442 | | Selected::Waiting => unreachable!(), | 443 | | Selected::Aborted | Selected::Disconnected => { | 444 | | self.receivers.unregister(oper).unwrap(); | 445 | | // If the channel was disconnected, we still have to check for remaining | 446 | | // messages. | 447 | | } | 448 | | Selected::Operation(_) => {} | 449 | | } | 450 | 0 | }); | 451 | | } | 452 | 19.9k | } |
|
453 | | |
454 | | /// Returns the current number of messages inside the channel. |
455 | 91.7k | pub(crate) fn len(&self) -> usize { |
456 | 94.1k | loop { |
457 | 94.1k | // Load the tail, then load the head. |
458 | 94.1k | let tail = self.tail.load(Ordering::SeqCst); |
459 | 94.1k | let head = self.head.load(Ordering::SeqCst); |
460 | 94.1k | |
461 | 94.1k | // If the tail didn't change, we've got consistent values to work with. |
462 | 94.1k | if self.tail.load(Ordering::SeqCst) == tail { |
463 | 91.7k | let hix = head & (self.mark_bit - 1); |
464 | 91.7k | let tix = tail & (self.mark_bit - 1); |
465 | 91.7k | |
466 | 91.7k | return if hix < tix { |
467 | 31.8k | tix - hix |
468 | 59.9k | } else if hix > tix { |
469 | 27.1k | self.cap - hix + tix |
470 | 32.7k | } else if (tail & !self.mark_bit) == head { |
471 | 33.2k | 0 |
472 | | } else { |
473 | 231 | self.cap |
474 | | }; |
475 | 2.37k | } |
476 | | } |
477 | 92.5k | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::len <crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 10.0k | pub(crate) fn len(&self) -> usize { | 456 | 10.0k | loop { | 457 | 10.0k | // Load the tail, then load the head. | 458 | 10.0k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 10.0k | let head = self.head.load(Ordering::SeqCst); | 460 | 10.0k | | 461 | 10.0k | // If the tail didn't change, we've got consistent values to work with. | 462 | 10.0k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 10.0k | let hix = head & (self.mark_bit - 1); | 464 | 10.0k | let tix = tail & (self.mark_bit - 1); | 465 | 10.0k | | 466 | 10.0k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 10.0k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 10.0k | } else if (tail & !self.mark_bit) == head { | 471 | 10.0k | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len <crossbeam_channel::flavors::array::Channel<usize>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 2 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 4 | pub(crate) fn len(&self) -> usize { | 456 | 4 | loop { | 457 | 4 | // Load the tail, then load the head. | 458 | 4 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 4 | let head = self.head.load(Ordering::SeqCst); | 460 | 4 | | 461 | 4 | // If the tail didn't change, we've got consistent values to work with. | 462 | 4 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 4 | let hix = head & (self.mark_bit - 1); | 464 | 4 | let tix = tail & (self.mark_bit - 1); | 465 | 4 | | 466 | 4 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 4 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 4 | } else if (tail & !self.mark_bit) == head { | 471 | 4 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 4 | } |
<crossbeam_channel::flavors::array::Channel<()>>::len Line | Count | Source | 455 | 6 | pub(crate) fn len(&self) -> usize { | 456 | 6 | loop { | 457 | 6 | // Load the tail, then load the head. | 458 | 6 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 6 | let head = self.head.load(Ordering::SeqCst); | 460 | 6 | | 461 | 6 | // If the tail didn't change, we've got consistent values to work with. | 462 | 6 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 6 | let hix = head & (self.mark_bit - 1); | 464 | 6 | let tix = tail & (self.mark_bit - 1); | 465 | 6 | | 466 | 6 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 6 | } else if hix > tix { | 469 | 1 | self.cap - hix + tix | 470 | 5 | } else if (tail & !self.mark_bit) == head { | 471 | 5 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 6 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Line | Count | Source | 455 | 2.00k | pub(crate) fn len(&self) -> usize { | 456 | 2.00k | loop { | 457 | 2.00k | // Load the tail, then load the head. | 458 | 2.00k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2.00k | let head = self.head.load(Ordering::SeqCst); | 460 | 2.00k | | 461 | 2.00k | // If the tail didn't change, we've got consistent values to work with. | 462 | 2.00k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2.00k | let hix = head & (self.mark_bit - 1); | 464 | 2.00k | let tix = tail & (self.mark_bit - 1); | 465 | 2.00k | | 466 | 2.00k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2.00k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2.00k | } else if (tail & !self.mark_bit) == head { | 471 | 2.00k | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len <crossbeam_channel::flavors::array::Channel<()>>::len Line | Count | Source | 455 | 203 | pub(crate) fn len(&self) -> usize { | 456 | 203 | loop { | 457 | 203 | // Load the tail, then load the head. | 458 | 203 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 203 | let head = self.head.load(Ordering::SeqCst); | 460 | 203 | | 461 | 203 | // If the tail didn't change, we've got consistent values to work with. | 462 | 203 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 203 | let hix = head & (self.mark_bit - 1); | 464 | 203 | let tix = tail & (self.mark_bit - 1); | 465 | 203 | | 466 | 203 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 203 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 203 | } else if (tail & !self.mark_bit) == head { | 471 | 203 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 203 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 0 | 0 | 472 | | } else { | 473 | 1 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 1 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::len <crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 12 | pub(crate) fn len(&self) -> usize { | 456 | 12 | loop { | 457 | 12 | // Load the tail, then load the head. | 458 | 12 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 12 | let head = self.head.load(Ordering::SeqCst); | 460 | 12 | | 461 | 12 | // If the tail didn't change, we've got consistent values to work with. | 462 | 12 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 12 | let hix = head & (self.mark_bit - 1); | 464 | 12 | let tix = tail & (self.mark_bit - 1); | 465 | 12 | | 466 | 12 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 12 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 12 | } else if (tail & !self.mark_bit) == head { | 471 | 9 | 0 | 472 | | } else { | 473 | 3 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 12 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len <crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::len Line | Count | Source | 455 | 100 | pub(crate) fn len(&self) -> usize { | 456 | 100 | loop { | 457 | 100 | // Load the tail, then load the head. | 458 | 100 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 100 | let head = self.head.load(Ordering::SeqCst); | 460 | 100 | | 461 | 100 | // If the tail didn't change, we've got consistent values to work with. | 462 | 100 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 100 | let hix = head & (self.mark_bit - 1); | 464 | 100 | let tix = tail & (self.mark_bit - 1); | 465 | 100 | | 466 | 100 | return if hix < tix { | 467 | 43 | tix - hix | 468 | 57 | } else if hix > tix { | 469 | 55 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 2 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 100 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 10.0k | pub(crate) fn len(&self) -> usize { | 456 | 10.0k | loop { | 457 | 10.0k | // Load the tail, then load the head. | 458 | 10.0k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 10.0k | let head = self.head.load(Ordering::SeqCst); | 460 | 10.0k | | 461 | 10.0k | // If the tail didn't change, we've got consistent values to work with. | 462 | 10.0k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 10.0k | let hix = head & (self.mark_bit - 1); | 464 | 10.0k | let tix = tail & (self.mark_bit - 1); | 465 | 10.0k | | 466 | 10.0k | return if hix < tix { | 467 | 1 | tix - hix | 468 | 10.0k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 10.0k | } else if (tail & !self.mark_bit) == head { | 471 | 10.0k | 0 | 472 | | } else { | 473 | 1 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::len Line | Count | Source | 455 | 26 | pub(crate) fn len(&self) -> usize { | 456 | 26 | loop { | 457 | 26 | // Load the tail, then load the head. | 458 | 26 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 26 | let head = self.head.load(Ordering::SeqCst); | 460 | 26 | | 461 | 26 | // If the tail didn't change, we've got consistent values to work with. | 462 | 26 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 26 | let hix = head & (self.mark_bit - 1); | 464 | 26 | let tix = tail & (self.mark_bit - 1); | 465 | 26 | | 466 | 26 | return if hix < tix { | 467 | 2 | tix - hix | 468 | 24 | } else if hix > tix { | 469 | 6 | self.cap - hix + tix | 470 | 18 | } else if (tail & !self.mark_bit) == head { | 471 | 14 | 0 | 472 | | } else { | 473 | 4 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 26 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::len Line | Count | Source | 455 | 58.2k | pub(crate) fn len(&self) -> usize { | 456 | 60.5k | loop { | 457 | 60.5k | // Load the tail, then load the head. | 458 | 60.5k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 60.5k | let head = self.head.load(Ordering::SeqCst); | 460 | 60.5k | | 461 | 60.5k | // If the tail didn't change, we've got consistent values to work with. | 462 | 60.5k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 58.2k | let hix = head & (self.mark_bit - 1); | 464 | 58.2k | let tix = tail & (self.mark_bit - 1); | 465 | 58.2k | | 466 | 58.2k | return if hix < tix { | 467 | 31.7k | tix - hix | 468 | 26.4k | } else if hix > tix { | 469 | 27.1k | self.cap - hix + tix | 470 | 18.4E | } else if (tail & !self.mark_bit) == head { | 471 | 121 | 0 | 472 | | } else { | 473 | 4 | self.cap | 474 | | }; | 475 | 2.37k | } | 476 | | } | 477 | 59.0k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Line | Count | Source | 455 | 1.00k | pub(crate) fn len(&self) -> usize { | 456 | 1.00k | loop { | 457 | 1.00k | // Load the tail, then load the head. | 458 | 1.00k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1.00k | let head = self.head.load(Ordering::SeqCst); | 460 | 1.00k | | 461 | 1.00k | // If the tail didn't change, we've got consistent values to work with. | 462 | 1.00k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1.00k | let hix = head & (self.mark_bit - 1); | 464 | 1.00k | let tix = tail & (self.mark_bit - 1); | 465 | 1.00k | | 466 | 1.00k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1.00k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1.00k | } else if (tail & !self.mark_bit) == head { | 471 | 1.00k | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1.00k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len <crossbeam_channel::flavors::array::Channel<usize>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 2 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len <crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 0 | 0 | 472 | | } else { | 473 | 1 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len <crossbeam_channel::flavors::array::Channel<alloc::string::String>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 1 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u8>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 2 | self.cap - hix + tix | 470 | 0 | } else if (tail & !self.mark_bit) == head { | 471 | 0 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 0 | 0 | 472 | | } else { | 473 | 1 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
<crossbeam_channel::flavors::array::Channel<bool>>::len Line | Count | Source | 455 | 3 | pub(crate) fn len(&self) -> usize { | 456 | 3 | loop { | 457 | 3 | // Load the tail, then load the head. | 458 | 3 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 3 | let head = self.head.load(Ordering::SeqCst); | 460 | 3 | | 461 | 3 | // If the tail didn't change, we've got consistent values to work with. | 462 | 3 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 3 | let hix = head & (self.mark_bit - 1); | 464 | 3 | let tix = tail & (self.mark_bit - 1); | 465 | 3 | | 466 | 3 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 3 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 3 | } else if (tail & !self.mark_bit) == head { | 471 | 3 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 3 | } |
<crossbeam_channel::flavors::array::Channel<i64>>::len Line | Count | Source | 455 | 1 | pub(crate) fn len(&self) -> usize { | 456 | 1 | loop { | 457 | 1 | // Load the tail, then load the head. | 458 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 1 | let head = self.head.load(Ordering::SeqCst); | 460 | 1 | | 461 | 1 | // If the tail didn't change, we've got consistent values to work with. | 462 | 1 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 1 | let hix = head & (self.mark_bit - 1); | 464 | 1 | let tix = tail & (self.mark_bit - 1); | 465 | 1 | | 466 | 1 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 1 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 1 | } else if (tail & !self.mark_bit) == head { | 471 | 1 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<golang::zerosize::zero_size_struct::ZeroSize>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<[u8; 0]>>::len <crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 5.11k | pub(crate) fn len(&self) -> usize { | 456 | 5.11k | loop { | 457 | 5.11k | // Load the tail, then load the head. | 458 | 5.11k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 5.11k | let head = self.head.load(Ordering::SeqCst); | 460 | 5.11k | | 461 | 5.11k | // If the tail didn't change, we've got consistent values to work with. | 462 | 5.11k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 5.11k | let hix = head & (self.mark_bit - 1); | 464 | 5.11k | let tix = tail & (self.mark_bit - 1); | 465 | 5.11k | | 466 | 5.11k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 5.11k | } else if hix > tix { | 469 | 1 | self.cap - hix + tix | 470 | 5.11k | } else if (tail & !self.mark_bit) == head { | 471 | 4.89k | 0 | 472 | | } else { | 473 | 215 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 5.11k | } |
<crossbeam_channel::flavors::array::Channel<u32>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 1 | 0 | 472 | | } else { | 473 | 1 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::len <crossbeam_channel::flavors::array::Channel<()>>::len Line | Count | Source | 455 | 7 | pub(crate) fn len(&self) -> usize { | 456 | 7 | loop { | 457 | 7 | // Load the tail, then load the head. | 458 | 7 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 7 | let head = self.head.load(Ordering::SeqCst); | 460 | 7 | | 461 | 7 | // If the tail didn't change, we've got consistent values to work with. | 462 | 7 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 7 | let hix = head & (self.mark_bit - 1); | 464 | 7 | let tix = tail & (self.mark_bit - 1); | 465 | 7 | | 466 | 7 | return if hix < tix { | 467 | 1 | tix - hix | 468 | 6 | } else if hix > tix { | 469 | 2 | self.cap - hix + tix | 470 | 4 | } else if (tail & !self.mark_bit) == head { | 471 | 4 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 7 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len <crossbeam_channel::flavors::array::Channel<usize>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 2 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Line | Count | Source | 455 | 2.00k | pub(crate) fn len(&self) -> usize { | 456 | 2.00k | loop { | 457 | 2.00k | // Load the tail, then load the head. | 458 | 2.00k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2.00k | let head = self.head.load(Ordering::SeqCst); | 460 | 2.00k | | 461 | 2.00k | // If the tail didn't change, we've got consistent values to work with. | 462 | 2.00k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2.00k | let hix = head & (self.mark_bit - 1); | 464 | 2.00k | let tix = tail & (self.mark_bit - 1); | 465 | 2.00k | | 466 | 2.00k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2.00k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2.00k | } else if (tail & !self.mark_bit) == head { | 471 | 2.00k | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::len Line | Count | Source | 455 | 4 | pub(crate) fn len(&self) -> usize { | 456 | 4 | loop { | 457 | 4 | // Load the tail, then load the head. | 458 | 4 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 4 | let head = self.head.load(Ordering::SeqCst); | 460 | 4 | | 461 | 4 | // If the tail didn't change, we've got consistent values to work with. | 462 | 4 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 4 | let hix = head & (self.mark_bit - 1); | 464 | 4 | let tix = tail & (self.mark_bit - 1); | 465 | 4 | | 466 | 4 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 4 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 4 | } else if (tail & !self.mark_bit) == head { | 471 | 4 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::len Line | Count | Source | 455 | 3.00k | pub(crate) fn len(&self) -> usize { | 456 | 3.00k | loop { | 457 | 3.00k | // Load the tail, then load the head. | 458 | 3.00k | let tail = self.tail.load(Ordering::SeqCst); | 459 | 3.00k | let head = self.head.load(Ordering::SeqCst); | 460 | 3.00k | | 461 | 3.00k | // If the tail didn't change, we've got consistent values to work with. | 462 | 3.00k | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 3.00k | let hix = head & (self.mark_bit - 1); | 464 | 3.00k | let tix = tail & (self.mark_bit - 1); | 465 | 3.00k | | 466 | 3.00k | return if hix < tix { | 467 | 0 | tix - hix | 468 | 3.00k | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 3.00k | } else if (tail & !self.mark_bit) == head { | 471 | 3.00k | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::len Line | Count | Source | 455 | 4 | pub(crate) fn len(&self) -> usize { | 456 | 4 | loop { | 457 | 4 | // Load the tail, then load the head. | 458 | 4 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 4 | let head = self.head.load(Ordering::SeqCst); | 460 | 4 | | 461 | 4 | // If the tail didn't change, we've got consistent values to work with. | 462 | 4 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 4 | let hix = head & (self.mark_bit - 1); | 464 | 4 | let tix = tail & (self.mark_bit - 1); | 465 | 4 | | 466 | 4 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 4 | } else if hix > tix { | 469 | 1 | self.cap - hix + tix | 470 | 3 | } else if (tail & !self.mark_bit) == head { | 471 | 3 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 4 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::len Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::len <crossbeam_channel::flavors::array::Channel<usize>>::len Line | Count | Source | 455 | 2 | pub(crate) fn len(&self) -> usize { | 456 | 2 | loop { | 457 | 2 | // Load the tail, then load the head. | 458 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 459 | 2 | let head = self.head.load(Ordering::SeqCst); | 460 | 2 | | 461 | 2 | // If the tail didn't change, we've got consistent values to work with. | 462 | 2 | if self.tail.load(Ordering::SeqCst) == tail { | 463 | 2 | let hix = head & (self.mark_bit - 1); | 464 | 2 | let tix = tail & (self.mark_bit - 1); | 465 | 2 | | 466 | 2 | return if hix < tix { | 467 | 0 | tix - hix | 468 | 2 | } else if hix > tix { | 469 | 0 | self.cap - hix + tix | 470 | 2 | } else if (tail & !self.mark_bit) == head { | 471 | 2 | 0 | 472 | | } else { | 473 | 0 | self.cap | 474 | | }; | 475 | 0 | } | 476 | | } | 477 | 2 | } |
|
478 | | |
479 | | /// Returns the capacity of the channel. |
480 | 18 | pub(crate) fn capacity(&self) -> Option<usize> { |
481 | 18 | Some(self.cap) |
482 | 18 | } |
483 | | |
484 | | /// Disconnects the channel and wakes up all blocked senders and receivers. |
485 | | /// |
486 | | /// Returns `true` if this call disconnected the channel. |
487 | 67.0k | pub(crate) fn disconnect(&self) -> bool { |
488 | 67.0k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); |
489 | 67.0k | |
490 | 67.0k | if tail & self.mark_bit == 0 { |
491 | 33.5k | self.senders.disconnect(); |
492 | 33.5k | self.receivers.disconnect(); |
493 | 33.5k | true |
494 | | } else { |
495 | 33.4k | false |
496 | | } |
497 | 67.0k | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::disconnect <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 20.0k | pub(crate) fn disconnect(&self) -> bool { | 488 | 20.0k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 20.0k | | 490 | 20.0k | if tail & self.mark_bit == 0 { | 491 | 10.0k | self.senders.disconnect(); | 492 | 10.0k | self.receivers.disconnect(); | 493 | 10.0k | true | 494 | | } else { | 495 | 10.0k | false | 496 | | } | 497 | 20.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect <crossbeam_channel::flavors::array::Channel<()>>::disconnect Line | Count | Source | 487 | 12 | pub(crate) fn disconnect(&self) -> bool { | 488 | 12 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 12 | | 490 | 12 | if tail & self.mark_bit == 0 { | 491 | 6 | self.senders.disconnect(); | 492 | 6 | self.receivers.disconnect(); | 493 | 6 | true | 494 | | } else { | 495 | 6 | false | 496 | | } | 497 | 12 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect Line | Count | Source | 487 | 3.99k | pub(crate) fn disconnect(&self) -> bool { | 488 | 3.99k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 3.99k | | 490 | 3.99k | if tail & self.mark_bit == 0 { | 491 | 2.00k | self.senders.disconnect(); | 492 | 2.00k | self.receivers.disconnect(); | 493 | 2.00k | true | 494 | | } else { | 495 | 1.99k | false | 496 | | } | 497 | 3.99k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 8 | pub(crate) fn disconnect(&self) -> bool { | 488 | 8 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 8 | | 490 | 8 | if tail & self.mark_bit == 0 { | 491 | 4 | self.senders.disconnect(); | 492 | 4 | self.receivers.disconnect(); | 493 | 4 | true | 494 | | } else { | 495 | 4 | false | 496 | | } | 497 | 8 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::disconnect <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 24 | pub(crate) fn disconnect(&self) -> bool { | 488 | 24 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 24 | | 490 | 24 | if tail & self.mark_bit == 0 { | 491 | 12 | self.senders.disconnect(); | 492 | 12 | self.receivers.disconnect(); | 493 | 12 | true | 494 | | } else { | 495 | 12 | false | 496 | | } | 497 | 24 | } |
<crossbeam_channel::flavors::array::Channel<()>>::disconnect Line | Count | Source | 487 | 406 | pub(crate) fn disconnect(&self) -> bool { | 488 | 406 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 406 | | 490 | 406 | if tail & self.mark_bit == 0 { | 491 | 203 | self.senders.disconnect(); | 492 | 203 | self.receivers.disconnect(); | 493 | 203 | true | 494 | | } else { | 495 | 203 | false | 496 | | } | 497 | 406 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Line | Count | Source | 487 | 10 | pub(crate) fn disconnect(&self) -> bool { | 488 | 10 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 10 | | 490 | 10 | if tail & self.mark_bit == 0 { | 491 | 5 | self.senders.disconnect(); | 492 | 5 | self.receivers.disconnect(); | 493 | 5 | true | 494 | | } else { | 495 | 5 | false | 496 | | } | 497 | 10 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect Line | Count | Source | 487 | 2.00k | pub(crate) fn disconnect(&self) -> bool { | 488 | 2.00k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2.00k | | 490 | 2.00k | if tail & self.mark_bit == 0 { | 491 | 1.00k | self.senders.disconnect(); | 492 | 1.00k | self.receivers.disconnect(); | 493 | 1.00k | true | 494 | | } else { | 495 | 1.00k | false | 496 | | } | 497 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::disconnect Line | Count | Source | 487 | 200 | pub(crate) fn disconnect(&self) -> bool { | 488 | 200 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 200 | | 490 | 200 | if tail & self.mark_bit == 0 { | 491 | 100 | self.senders.disconnect(); | 492 | 100 | self.receivers.disconnect(); | 493 | 100 | true | 494 | | } else { | 495 | 100 | false | 496 | | } | 497 | 200 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 20.0k | pub(crate) fn disconnect(&self) -> bool { | 488 | 20.0k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 20.0k | | 490 | 20.0k | if tail & self.mark_bit == 0 { | 491 | 10.0k | self.senders.disconnect(); | 492 | 10.0k | self.receivers.disconnect(); | 493 | 10.0k | true | 494 | | } else { | 495 | 10.0k | false | 496 | | } | 497 | 20.0k | } |
<crossbeam_channel::flavors::array::Channel<()>>::disconnect Line | Count | Source | 487 | 36 | pub(crate) fn disconnect(&self) -> bool { | 488 | 36 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 36 | | 490 | 36 | if tail & self.mark_bit == 0 { | 491 | 18 | self.senders.disconnect(); | 492 | 18 | self.receivers.disconnect(); | 493 | 18 | true | 494 | | } else { | 495 | 18 | false | 496 | | } | 497 | 36 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()>>::disconnect <crossbeam_channel::flavors::array::Channel<bool>>::disconnect Line | Count | Source | 487 | 6 | pub(crate) fn disconnect(&self) -> bool { | 488 | 6 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 6 | | 490 | 6 | if tail & self.mark_bit == 0 { | 491 | 3 | self.senders.disconnect(); | 492 | 3 | self.receivers.disconnect(); | 493 | 3 | true | 494 | | } else { | 495 | 3 | false | 496 | | } | 497 | 6 | } |
<crossbeam_channel::flavors::array::Channel<i64>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<golang::zerosize::zero_size_struct::ZeroSize>>::disconnect Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<[u8; 0]>>::disconnect <crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 10.2k | pub(crate) fn disconnect(&self) -> bool { | 488 | 10.2k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 10.2k | | 490 | 10.2k | if tail & self.mark_bit == 0 { | 491 | 5.11k | self.senders.disconnect(); | 492 | 5.11k | self.receivers.disconnect(); | 493 | 5.11k | true | 494 | | } else { | 495 | 5.10k | false | 496 | | } | 497 | 10.2k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize>>::disconnect <crossbeam_channel::flavors::array::Channel<u8>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
<crossbeam_channel::flavors::array::Channel<u32>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String>>::disconnect Line | Count | Source | 487 | 2 | pub(crate) fn disconnect(&self) -> bool { | 488 | 2 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 2 | | 490 | 2 | if tail & self.mark_bit == 0 { | 491 | 1 | self.senders.disconnect(); | 492 | 1 | self.receivers.disconnect(); | 493 | 1 | true | 494 | | } else { | 495 | 1 | false | 496 | | } | 497 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect Line | Count | Source | 487 | 4.00k | pub(crate) fn disconnect(&self) -> bool { | 488 | 4.00k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4.00k | | 490 | 4.00k | if tail & self.mark_bit == 0 { | 491 | 2.00k | self.senders.disconnect(); | 492 | 2.00k | self.receivers.disconnect(); | 493 | 2.00k | true | 494 | | } else { | 495 | 2.00k | false | 496 | | } | 497 | 4.00k | } |
<crossbeam_channel::flavors::array::Channel<i32>>::disconnect Line | Count | Source | 487 | 8 | pub(crate) fn disconnect(&self) -> bool { | 488 | 8 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 8 | | 490 | 8 | if tail & self.mark_bit == 0 { | 491 | 4 | self.senders.disconnect(); | 492 | 4 | self.receivers.disconnect(); | 493 | 4 | true | 494 | | } else { | 495 | 4 | false | 496 | | } | 497 | 8 | } |
<crossbeam_channel::flavors::array::Channel<()>>::disconnect Line | Count | Source | 487 | 14 | pub(crate) fn disconnect(&self) -> bool { | 488 | 14 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 14 | | 490 | 14 | if tail & self.mark_bit == 0 { | 491 | 7 | self.senders.disconnect(); | 492 | 7 | self.receivers.disconnect(); | 493 | 7 | true | 494 | | } else { | 495 | 7 | false | 496 | | } | 497 | 14 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32>>::disconnect <crossbeam_channel::flavors::array::Channel<usize>>::disconnect Line | Count | Source | 487 | 4 | pub(crate) fn disconnect(&self) -> bool { | 488 | 4 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 4 | | 490 | 4 | if tail & self.mark_bit == 0 { | 491 | 2 | self.senders.disconnect(); | 492 | 2 | self.receivers.disconnect(); | 493 | 2 | true | 494 | | } else { | 495 | 2 | false | 496 | | } | 497 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::disconnect Line | Count | Source | 487 | 6.00k | pub(crate) fn disconnect(&self) -> bool { | 488 | 6.00k | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 6.00k | | 490 | 6.00k | if tail & self.mark_bit == 0 { | 491 | 3.00k | self.senders.disconnect(); | 492 | 3.00k | self.receivers.disconnect(); | 493 | 3.00k | true | 494 | | } else { | 495 | 3.00k | false | 496 | | } | 497 | 6.00k | } |
<crossbeam_channel::flavors::array::Channel<()>>::disconnect Line | Count | Source | 487 | 8 | pub(crate) fn disconnect(&self) -> bool { | 488 | 8 | let tail = self.tail.fetch_or(self.mark_bit, Ordering::SeqCst); | 489 | 8 | | 490 | 8 | if tail & self.mark_bit == 0 { | 491 | 4 | self.senders.disconnect(); | 492 | 4 | self.receivers.disconnect(); | 493 | 4 | true | 494 | | } else { | 495 | 4 | false | 496 | | } | 497 | 8 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant>>::disconnect |
498 | | |
499 | | /// Returns `true` if the channel is disconnected. |
500 | 83.2k | pub(crate) fn is_disconnected(&self) -> bool { |
501 | 83.2k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 |
502 | 83.2k | } <crossbeam_channel::flavors::array::Channel<i32>>::is_disconnected Line | Count | Source | 500 | 79 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 79 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 79 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::is_disconnected Line | Count | Source | 500 | 439 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 439 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 439 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_disconnected Line | Count | Source | 500 | 34 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 34 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 34 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_disconnected Line | Count | Source | 500 | 211 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 211 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 211 | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::is_disconnected Line | Count | Source | 500 | 4 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 4 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 4 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_disconnected Line | Count | Source | 500 | 4 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 4 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 4 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_disconnected Line | Count | Source | 500 | 7 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 7 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 7 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_disconnected Line | Count | Source | 500 | 112 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 112 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 112 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_disconnected Line | Count | Source | 500 | 42.5k | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 42.5k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 42.5k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::is_disconnected Line | Count | Source | 500 | 2 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 2 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 2 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_disconnected Line | Count | Source | 500 | 96 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 96 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 96 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_disconnected Line | Count | Source | 500 | 136 | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 136 | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 136 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_disconnected Line | Count | Source | 500 | 2.16k | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 2.16k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 2.16k | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_disconnected Line | Count | Source | 500 | 22.7k | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 22.7k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 22.7k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::is_disconnected Line | Count | Source | 500 | 8.64k | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 8.64k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 8.64k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_disconnected Line | Count | Source | 500 | 5.96k | pub(crate) fn is_disconnected(&self) -> bool { | 501 | 5.96k | self.tail.load(Ordering::SeqCst) & self.mark_bit != 0 | 502 | 5.96k | } |
|
503 | | |
504 | | /// Returns `true` if the channel is empty. |
505 | 245k | pub(crate) fn is_empty(&self) -> bool { |
506 | 245k | let head = self.head.load(Ordering::SeqCst); |
507 | 245k | let tail = self.tail.load(Ordering::SeqCst); |
508 | 245k | |
509 | 245k | // Is the tail equal to the head? |
510 | 245k | // |
511 | 245k | // Note: If the head changes just before we load the tail, that means there was a moment |
512 | 245k | // when the channel was not empty, so it is safe to just return `false`. |
513 | 245k | (tail & !self.mark_bit) == head |
514 | 245k | } <crossbeam_channel::flavors::array::Channel<i32>>::is_empty Line | Count | Source | 505 | 486 | pub(crate) fn is_empty(&self) -> bool { | 506 | 486 | let head = self.head.load(Ordering::SeqCst); | 507 | 486 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 486 | | 509 | 486 | // Is the tail equal to the head? | 510 | 486 | // | 511 | 486 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 486 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 486 | (tail & !self.mark_bit) == head | 514 | 486 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_empty Line | Count | Source | 505 | 10.0k | pub(crate) fn is_empty(&self) -> bool { | 506 | 10.0k | let head = self.head.load(Ordering::SeqCst); | 507 | 10.0k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 10.0k | | 509 | 10.0k | // Is the tail equal to the head? | 510 | 10.0k | // | 511 | 10.0k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 10.0k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 10.0k | (tail & !self.mark_bit) == head | 514 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_empty Line | Count | Source | 505 | 500 | pub(crate) fn is_empty(&self) -> bool { | 506 | 500 | let head = self.head.load(Ordering::SeqCst); | 507 | 500 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 500 | | 509 | 500 | // Is the tail equal to the head? | 510 | 500 | // | 511 | 500 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 500 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 500 | (tail & !self.mark_bit) == head | 514 | 500 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::is_empty Line | Count | Source | 505 | 955 | pub(crate) fn is_empty(&self) -> bool { | 506 | 955 | let head = self.head.load(Ordering::SeqCst); | 507 | 955 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 955 | | 509 | 955 | // Is the tail equal to the head? | 510 | 955 | // | 511 | 955 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 955 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 955 | (tail & !self.mark_bit) == head | 514 | 955 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_empty Line | Count | Source | 505 | 2 | pub(crate) fn is_empty(&self) -> bool { | 506 | 2 | let head = self.head.load(Ordering::SeqCst); | 507 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 2 | | 509 | 2 | // Is the tail equal to the head? | 510 | 2 | // | 511 | 2 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 2 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 2 | (tail & !self.mark_bit) == head | 514 | 2 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_empty Line | Count | Source | 505 | 22 | pub(crate) fn is_empty(&self) -> bool { | 506 | 22 | let head = self.head.load(Ordering::SeqCst); | 507 | 22 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 22 | | 509 | 22 | // Is the tail equal to the head? | 510 | 22 | // | 511 | 22 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 22 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 22 | (tail & !self.mark_bit) == head | 514 | 22 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_empty Line | Count | Source | 505 | 641 | pub(crate) fn is_empty(&self) -> bool { | 506 | 641 | let head = self.head.load(Ordering::SeqCst); | 507 | 641 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 641 | | 509 | 641 | // Is the tail equal to the head? | 510 | 641 | // | 511 | 641 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 641 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 641 | (tail & !self.mark_bit) == head | 514 | 641 | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter>>::is_empty Line | Count | Source | 505 | 21 | pub(crate) fn is_empty(&self) -> bool { | 506 | 21 | let head = self.head.load(Ordering::SeqCst); | 507 | 21 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 21 | | 509 | 21 | // Is the tail equal to the head? | 510 | 21 | // | 511 | 21 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 21 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 21 | (tail & !self.mark_bit) == head | 514 | 21 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_empty Line | Count | Source | 505 | 97 | pub(crate) fn is_empty(&self) -> bool { | 506 | 97 | let head = self.head.load(Ordering::SeqCst); | 507 | 97 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 97 | | 509 | 97 | // Is the tail equal to the head? | 510 | 97 | // | 511 | 97 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 97 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 97 | (tail & !self.mark_bit) == head | 514 | 97 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_empty Line | Count | Source | 505 | 23.3k | pub(crate) fn is_empty(&self) -> bool { | 506 | 23.3k | let head = self.head.load(Ordering::SeqCst); | 507 | 23.3k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 23.3k | | 509 | 23.3k | // Is the tail equal to the head? | 510 | 23.3k | // | 511 | 23.3k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 23.3k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 23.3k | (tail & !self.mark_bit) == head | 514 | 23.3k | } |
<crossbeam_channel::flavors::array::Channel<bool>>::is_empty Line | Count | Source | 505 | 1 | pub(crate) fn is_empty(&self) -> bool { | 506 | 1 | let head = self.head.load(Ordering::SeqCst); | 507 | 1 | let tail = self.tail.load(Ordering::SeqCst); | 508 | 1 | | 509 | 1 | // Is the tail equal to the head? | 510 | 1 | // | 511 | 1 | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 1 | // when the channel was not empty, so it is safe to just return `false`. | 513 | 1 | (tail & !self.mark_bit) == head | 514 | 1 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_empty Line | Count | Source | 505 | 10.3k | pub(crate) fn is_empty(&self) -> bool { | 506 | 10.3k | let head = self.head.load(Ordering::SeqCst); | 507 | 10.3k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 10.3k | | 509 | 10.3k | // Is the tail equal to the head? | 510 | 10.3k | // | 511 | 10.3k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 10.3k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 10.3k | (tail & !self.mark_bit) == head | 514 | 10.3k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_empty Line | Count | Source | 505 | 5.75k | pub(crate) fn is_empty(&self) -> bool { | 506 | 5.75k | let head = self.head.load(Ordering::SeqCst); | 507 | 5.75k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 5.75k | | 509 | 5.75k | // Is the tail equal to the head? | 510 | 5.75k | // | 511 | 5.75k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 5.75k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 5.75k | (tail & !self.mark_bit) == head | 514 | 5.75k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::is_empty Line | Count | Source | 505 | 11.6k | pub(crate) fn is_empty(&self) -> bool { | 506 | 11.6k | let head = self.head.load(Ordering::SeqCst); | 507 | 11.6k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 11.6k | | 509 | 11.6k | // Is the tail equal to the head? | 510 | 11.6k | // | 511 | 11.6k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 11.6k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 11.6k | (tail & !self.mark_bit) == head | 514 | 11.6k | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_empty Line | Count | Source | 505 | 15.9k | pub(crate) fn is_empty(&self) -> bool { | 506 | 15.9k | let head = self.head.load(Ordering::SeqCst); | 507 | 15.9k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 15.9k | | 509 | 15.9k | // Is the tail equal to the head? | 510 | 15.9k | // | 511 | 15.9k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 15.9k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 15.9k | (tail & !self.mark_bit) == head | 514 | 15.9k | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_empty Line | Count | Source | 505 | 165k | pub(crate) fn is_empty(&self) -> bool { | 506 | 165k | let head = self.head.load(Ordering::SeqCst); | 507 | 165k | let tail = self.tail.load(Ordering::SeqCst); | 508 | 165k | | 509 | 165k | // Is the tail equal to the head? | 510 | 165k | // | 511 | 165k | // Note: If the head changes just before we load the tail, that means there was a moment | 512 | 165k | // when the channel was not empty, so it is safe to just return `false`. | 513 | 165k | (tail & !self.mark_bit) == head | 514 | 165k | } |
|
515 | | |
516 | | /// Returns `true` if the channel is full. |
517 | 30.6k | pub(crate) fn is_full(&self) -> bool { |
518 | 30.6k | let tail = self.tail.load(Ordering::SeqCst); |
519 | 30.6k | let head = self.head.load(Ordering::SeqCst); |
520 | 30.6k | |
521 | 30.6k | // Is the head lagging one lap behind tail? |
522 | 30.6k | // |
523 | 30.6k | // Note: If the tail changes just before we load the head, that means there was a moment |
524 | 30.6k | // when the channel was not full, so it is safe to just return `false`. |
525 | 30.6k | head.wrapping_add(self.one_lap) == tail & !self.mark_bit |
526 | 30.6k | } <crossbeam_channel::flavors::array::Channel<usize>>::is_full Line | Count | Source | 517 | 5 | pub(crate) fn is_full(&self) -> bool { | 518 | 5 | let tail = self.tail.load(Ordering::SeqCst); | 519 | 5 | let head = self.head.load(Ordering::SeqCst); | 520 | 5 | | 521 | 5 | // Is the head lagging one lap behind tail? | 522 | 5 | // | 523 | 5 | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 5 | // when the channel was not full, so it is safe to just return `false`. | 525 | 5 | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 5 | } |
<crossbeam_channel::flavors::array::Channel<()>>::is_full Line | Count | Source | 517 | 21 | pub(crate) fn is_full(&self) -> bool { | 518 | 21 | let tail = self.tail.load(Ordering::SeqCst); | 519 | 21 | let head = self.head.load(Ordering::SeqCst); | 520 | 21 | | 521 | 21 | // Is the head lagging one lap behind tail? | 522 | 21 | // | 523 | 21 | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 21 | // when the channel was not full, so it is safe to just return `false`. | 525 | 21 | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 21 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_full Line | Count | Source | 517 | 2 | pub(crate) fn is_full(&self) -> bool { | 518 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 519 | 2 | let head = self.head.load(Ordering::SeqCst); | 520 | 2 | | 521 | 2 | // Is the head lagging one lap behind tail? | 522 | 2 | // | 523 | 2 | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 2 | // when the channel was not full, so it is safe to just return `false`. | 525 | 2 | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32>>::is_full Line | Count | Source | 517 | 27.6k | pub(crate) fn is_full(&self) -> bool { | 518 | 27.6k | let tail = self.tail.load(Ordering::SeqCst); | 519 | 27.6k | let head = self.head.load(Ordering::SeqCst); | 520 | 27.6k | | 521 | 27.6k | // Is the head lagging one lap behind tail? | 522 | 27.6k | // | 523 | 27.6k | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 27.6k | // when the channel was not full, so it is safe to just return `false`. | 525 | 27.6k | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 27.6k | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>>>::is_full Line | Count | Source | 517 | 2 | pub(crate) fn is_full(&self) -> bool { | 518 | 2 | let tail = self.tail.load(Ordering::SeqCst); | 519 | 2 | let head = self.head.load(Ordering::SeqCst); | 520 | 2 | | 521 | 2 | // Is the head lagging one lap behind tail? | 522 | 2 | // | 523 | 2 | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 2 | // when the channel was not full, so it is safe to just return `false`. | 525 | 2 | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 2 | } |
<crossbeam_channel::flavors::array::Channel<usize>>::is_full Line | Count | Source | 517 | 20 | pub(crate) fn is_full(&self) -> bool { | 518 | 20 | let tail = self.tail.load(Ordering::SeqCst); | 519 | 20 | let head = self.head.load(Ordering::SeqCst); | 520 | 20 | | 521 | 20 | // Is the head lagging one lap behind tail? | 522 | 20 | // | 523 | 20 | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 20 | // when the channel was not full, so it is safe to just return `false`. | 525 | 20 | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 20 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>>>::is_full Line | Count | Source | 517 | 3.00k | pub(crate) fn is_full(&self) -> bool { | 518 | 3.00k | let tail = self.tail.load(Ordering::SeqCst); | 519 | 3.00k | let head = self.head.load(Ordering::SeqCst); | 520 | 3.00k | | 521 | 3.00k | // Is the head lagging one lap behind tail? | 522 | 3.00k | // | 523 | 3.00k | // Note: If the tail changes just before we load the head, that means there was a moment | 524 | 3.00k | // when the channel was not full, so it is safe to just return `false`. | 525 | 3.00k | head.wrapping_add(self.one_lap) == tail & !self.mark_bit | 526 | 3.00k | } |
|
527 | | } |
528 | | |
529 | | impl<T> Drop for Channel<T> { |
530 | 33.5k | fn drop(&mut self) { |
531 | 33.5k | // Get the index of the head. |
532 | 33.5k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); |
533 | | |
534 | | // Loop over all slots that hold a message and drop them. |
535 | 75.0k | for i in 0..self.len()33.5k { |
536 | | // Compute the index of the next slot holding a message. |
537 | 75.0k | let index = if hix + i < self.cap { |
538 | 73.8k | hix + i |
539 | | } else { |
540 | 1.11k | hix + i - self.cap |
541 | | }; |
542 | | |
543 | 75.0k | unsafe { |
544 | 75.0k | let p = { |
545 | 75.0k | let slot = &mut *self.buffer.add(index); |
546 | 75.0k | let msg = &mut *slot.msg.get(); |
547 | 75.0k | msg.as_mut_ptr() |
548 | 75.0k | }; |
549 | 75.0k | p.drop_in_place(); |
550 | 75.0k | } |
551 | | } |
552 | | |
553 | | // Finally, deallocate the buffer, but don't run any destructors. |
554 | 33.5k | unsafe { |
555 | 33.5k | // Create a slice from the buffer to make |
556 | 33.5k | // a fat pointer. Then, use Box::from_raw |
557 | 33.5k | // to deallocate it. |
558 | 33.5k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; |
559 | 33.5k | Box::from_raw(ptr); |
560 | 33.5k | } |
561 | 33.5k | } Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<zero::drops::DropCounter> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 10.0k | fn drop(&mut self) { | 531 | 10.0k | // Get the index of the head. | 532 | 10.0k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 10.0k | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 10.0k | unsafe { | 555 | 10.0k | // Create a slice from the buffer to make | 556 | 10.0k | // a fat pointer. Then, use Box::from_raw | 557 | 10.0k | // to deallocate it. | 558 | 10.0k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 10.0k | Box::from_raw(ptr); | 560 | 10.0k | } | 561 | 10.0k | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 6 | fn drop(&mut self) { | 531 | 6 | // Get the index of the head. | 532 | 6 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 7.53k | for i in 0..self.len()6 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 7.53k | let index = if hix + i < self.cap { | 538 | 7.53k | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 7.53k | unsafe { | 544 | 7.53k | let p = { | 545 | 7.53k | let slot = &mut *self.buffer.add(index); | 546 | 7.53k | let msg = &mut *slot.msg.get(); | 547 | 7.53k | msg.as_mut_ptr() | 548 | 7.53k | }; | 549 | 7.53k | p.drop_in_place(); | 550 | 7.53k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 6 | unsafe { | 555 | 6 | // Create a slice from the buffer to make | 556 | 6 | // a fat pointer. Then, use Box::from_raw | 557 | 6 | // to deallocate it. | 558 | 6 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 6 | Box::from_raw(ptr); | 560 | 6 | } | 561 | 6 | } |
<crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2.00k | fn drop(&mut self) { | 531 | 2.00k | // Get the index of the head. | 532 | 2.00k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2.00k | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2.00k | unsafe { | 555 | 2.00k | // Create a slice from the buffer to make | 556 | 2.00k | // a fat pointer. Then, use Box::from_raw | 557 | 2.00k | // to deallocate it. | 558 | 2.00k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2.00k | Box::from_raw(ptr); | 560 | 2.00k | } | 561 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 4 | fn drop(&mut self) { | 531 | 4 | // Get the index of the head. | 532 | 4 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 4 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 4 | unsafe { | 555 | 4 | // Create a slice from the buffer to make | 556 | 4 | // a fat pointer. Then, use Box::from_raw | 557 | 4 | // to deallocate it. | 558 | 4 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 4 | Box::from_raw(ptr); | 560 | 4 | } | 561 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<isize>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 1 | let index = if hix + i < self.cap { | 538 | 1 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 1 | unsafe { | 544 | 1 | let p = { | 545 | 1 | let slot = &mut *self.buffer.add(index); | 546 | 1 | let msg = &mut *slot.msg.get(); | 547 | 1 | msg.as_mut_ptr() | 548 | 1 | }; | 549 | 1 | p.drop_in_place(); | 550 | 1 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 203 | fn drop(&mut self) { | 531 | 203 | // Get the index of the head. | 532 | 203 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 203 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 203 | unsafe { | 555 | 203 | // Create a slice from the buffer to make | 556 | 203 | // a fat pointer. Then, use Box::from_raw | 557 | 203 | // to deallocate it. | 558 | 203 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 203 | Box::from_raw(ptr); | 560 | 203 | } | 561 | 203 | } |
<crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 12 | fn drop(&mut self) { | 531 | 12 | // Get the index of the head. | 532 | 12 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 12 | for i3 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 3 | let index = if hix + i < self.cap { | 538 | 3 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 3 | unsafe { | 544 | 3 | let p = { | 545 | 3 | let slot = &mut *self.buffer.add(index); | 546 | 3 | let msg = &mut *slot.msg.get(); | 547 | 3 | msg.as_mut_ptr() | 548 | 3 | }; | 549 | 3 | p.drop_in_place(); | 550 | 3 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 12 | unsafe { | 555 | 12 | // Create a slice from the buffer to make | 556 | 12 | // a fat pointer. Then, use Box::from_raw | 557 | 12 | // to deallocate it. | 558 | 12 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 12 | Box::from_raw(ptr); | 560 | 12 | } | 561 | 12 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<i32>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 18 | fn drop(&mut self) { | 531 | 18 | // Get the index of the head. | 532 | 18 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 10.0k | for i in 0..self.len()18 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 10.0k | let index = if hix + i < self.cap { | 538 | 10.0k | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 10.0k | unsafe { | 544 | 10.0k | let p = { | 545 | 10.0k | let slot = &mut *self.buffer.add(index); | 546 | 10.0k | let msg = &mut *slot.msg.get(); | 547 | 10.0k | msg.as_mut_ptr() | 548 | 10.0k | }; | 549 | 10.0k | p.drop_in_place(); | 550 | 10.0k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 18 | unsafe { | 555 | 18 | // Create a slice from the buffer to make | 556 | 18 | // a fat pointer. Then, use Box::from_raw | 557 | 18 | // to deallocate it. | 558 | 18 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 18 | Box::from_raw(ptr); | 560 | 18 | } | 561 | 18 | } |
<crossbeam_channel::flavors::array::Channel<array::drops::DropCounter> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 100 | fn drop(&mut self) { | 531 | 100 | // Get the index of the head. | 532 | 100 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2.45k | for i in 0..self.len()100 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 2.45k | let index = if hix + i < self.cap { | 538 | 1.54k | hix + i | 539 | | } else { | 540 | 914 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 2.45k | unsafe { | 544 | 2.45k | let p = { | 545 | 2.45k | let slot = &mut *self.buffer.add(index); | 546 | 2.45k | let msg = &mut *slot.msg.get(); | 547 | 2.45k | msg.as_mut_ptr() | 548 | 2.45k | }; | 549 | 2.45k | p.drop_in_place(); | 550 | 2.45k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 100 | unsafe { | 555 | 100 | // Create a slice from the buffer to make | 556 | 100 | // a fat pointer. Then, use Box::from_raw | 557 | 100 | // to deallocate it. | 558 | 100 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 100 | Box::from_raw(ptr); | 560 | 100 | } | 561 | 100 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1.00k | fn drop(&mut self) { | 531 | 1.00k | // Get the index of the head. | 532 | 1.00k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1.00k | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1.00k | unsafe { | 555 | 1.00k | // Create a slice from the buffer to make | 556 | 1.00k | // a fat pointer. Then, use Box::from_raw | 557 | 1.00k | // to deallocate it. | 558 | 1.00k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1.00k | Box::from_raw(ptr); | 560 | 1.00k | } | 561 | 1.00k | } |
<crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 10.0k | fn drop(&mut self) { | 531 | 10.0k | // Get the index of the head. | 532 | 10.0k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 10.0k | for i4 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 4 | let index = if hix + i < self.cap { | 538 | 4 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 4 | unsafe { | 544 | 4 | let p = { | 545 | 4 | let slot = &mut *self.buffer.add(index); | 546 | 4 | let msg = &mut *slot.msg.get(); | 547 | 4 | msg.as_mut_ptr() | 548 | 4 | }; | 549 | 4 | p.drop_in_place(); | 550 | 4 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 10.0k | unsafe { | 555 | 10.0k | // Create a slice from the buffer to make | 556 | 10.0k | // a fat pointer. Then, use Box::from_raw | 557 | 10.0k | // to deallocate it. | 558 | 10.0k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 10.0k | Box::from_raw(ptr); | 560 | 10.0k | } | 561 | 10.0k | } |
<crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 5 | fn drop(&mut self) { | 531 | 5 | // Get the index of the head. | 532 | 5 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 5 | for i1 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 1 | let index = if hix + i < self.cap { | 538 | 1 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 1 | unsafe { | 544 | 1 | let p = { | 545 | 1 | let slot = &mut *self.buffer.add(index); | 546 | 1 | let msg = &mut *slot.msg.get(); | 547 | 1 | msg.as_mut_ptr() | 548 | 1 | }; | 549 | 1 | p.drop_in_place(); | 550 | 1 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 5 | unsafe { | 555 | 5 | // Create a slice from the buffer to make | 556 | 5 | // a fat pointer. Then, use Box::from_raw | 557 | 5 | // to deallocate it. | 558 | 5 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 5 | Box::from_raw(ptr); | 560 | 5 | } | 561 | 5 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
<crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 1 | let index = if hix + i < self.cap { | 538 | 1 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 1 | unsafe { | 544 | 1 | let p = { | 545 | 1 | let slot = &mut *self.buffer.add(index); | 546 | 1 | let msg = &mut *slot.msg.get(); | 547 | 1 | msg.as_mut_ptr() | 548 | 1 | }; | 549 | 1 | p.drop_in_place(); | 550 | 1 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<list::drops::DropCounter> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<i64> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
<crossbeam_channel::flavors::array::Channel<u8> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 10.0k | for i in 0..self.len()2 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 10.0k | let index = if hix + i < self.cap { | 538 | 10.0k | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 10.0k | unsafe { | 544 | 10.0k | let p = { | 545 | 10.0k | let slot = &mut *self.buffer.add(index); | 546 | 10.0k | let msg = &mut *slot.msg.get(); | 547 | 10.0k | msg.as_mut_ptr() | 548 | 10.0k | }; | 549 | 10.0k | p.drop_in_place(); | 550 | 10.0k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<[u8; 0]> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 5.11k | fn drop(&mut self) { | 531 | 5.11k | // Get the index of the head. | 532 | 5.11k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 19.9k | for i in 0..self.len()5.11k { | 536 | | // Compute the index of the next slot holding a message. | 537 | 19.9k | let index = if hix + i < self.cap { | 538 | 19.7k | hix + i | 539 | | } else { | 540 | 200 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 19.9k | unsafe { | 544 | 19.9k | let p = { | 545 | 19.9k | let slot = &mut *self.buffer.add(index); | 546 | 19.9k | let msg = &mut *slot.msg.get(); | 547 | 19.9k | msg.as_mut_ptr() | 548 | 19.9k | }; | 549 | 19.9k | p.drop_in_place(); | 550 | 19.9k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 5.11k | unsafe { | 555 | 5.11k | // Create a slice from the buffer to make | 556 | 5.11k | // a fat pointer. Then, use Box::from_raw | 557 | 5.11k | // to deallocate it. | 558 | 5.11k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 5.11k | Box::from_raw(ptr); | 560 | 5.11k | } | 561 | 5.11k | } |
<crossbeam_channel::flavors::array::Channel<bool> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 3 | fn drop(&mut self) { | 531 | 3 | // Get the index of the head. | 532 | 3 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 3 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 3 | unsafe { | 555 | 3 | // Create a slice from the buffer to make | 556 | 3 | // a fat pointer. Then, use Box::from_raw | 557 | 3 | // to deallocate it. | 558 | 3 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 3 | Box::from_raw(ptr); | 560 | 3 | } | 561 | 3 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 1 | let index = if hix + i < self.cap { | 538 | 1 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 1 | unsafe { | 544 | 1 | let p = { | 545 | 1 | let slot = &mut *self.buffer.add(index); | 546 | 1 | let msg = &mut *slot.msg.get(); | 547 | 1 | msg.as_mut_ptr() | 548 | 1 | }; | 549 | 1 | p.drop_in_place(); | 550 | 1 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
<crossbeam_channel::flavors::array::Channel<alloc::string::String> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 1 | fn drop(&mut self) { | 531 | 1 | // Get the index of the head. | 532 | 1 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 1 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 1 | unsafe { | 555 | 1 | // Create a slice from the buffer to make | 556 | 1 | // a fat pointer. Then, use Box::from_raw | 557 | 1 | // to deallocate it. | 558 | 1 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 1 | Box::from_raw(ptr); | 560 | 1 | } | 561 | 1 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<golang::zerosize::zero_size_struct::ZeroSize> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<u32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2 | for i1 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 1 | let index = if hix + i < self.cap { | 538 | 1 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 1 | unsafe { | 544 | 1 | let p = { | 545 | 1 | let slot = &mut *self.buffer.add(index); | 546 | 1 | let msg = &mut *slot.msg.get(); | 547 | 1 | msg.as_mut_ptr() | 548 | 1 | }; | 549 | 1 | p.drop_in_place(); | 550 | 1 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
<crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 7 | fn drop(&mut self) { | 531 | 7 | // Get the index of the head. | 532 | 7 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 17.5k | for i in 0..self.len()7 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 17.5k | let index = if hix + i < self.cap { | 538 | 17.5k | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 17.5k | unsafe { | 544 | 17.5k | let p = { | 545 | 17.5k | let slot = &mut *self.buffer.add(index); | 546 | 17.5k | let msg = &mut *slot.msg.get(); | 547 | 17.5k | msg.as_mut_ptr() | 548 | 17.5k | }; | 549 | 17.5k | p.drop_in_place(); | 550 | 17.5k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 7 | unsafe { | 555 | 7 | // Create a slice from the buffer to make | 556 | 7 | // a fat pointer. Then, use Box::from_raw | 557 | 7 | // to deallocate it. | 558 | 7 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 7 | Box::from_raw(ptr); | 560 | 7 | } | 561 | 7 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2.00k | fn drop(&mut self) { | 531 | 2.00k | // Get the index of the head. | 532 | 2.00k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2.00k | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2.00k | unsafe { | 555 | 2.00k | // Create a slice from the buffer to make | 556 | 2.00k | // a fat pointer. Then, use Box::from_raw | 557 | 2.00k | // to deallocate it. | 558 | 2.00k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2.00k | Box::from_raw(ptr); | 560 | 2.00k | } | 561 | 2.00k | } |
<crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 4 | fn drop(&mut self) { | 531 | 4 | // Get the index of the head. | 532 | 4 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 4 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 4 | unsafe { | 555 | 4 | // Create a slice from the buffer to make | 556 | 4 | // a fat pointer. Then, use Box::from_raw | 557 | 4 | // to deallocate it. | 558 | 4 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 4 | Box::from_raw(ptr); | 560 | 4 | } | 561 | 4 | } |
<crossbeam_channel::flavors::array::Channel<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 3.00k | fn drop(&mut self) { | 531 | 3.00k | // Get the index of the head. | 532 | 3.00k | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 3.00k | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 3.00k | unsafe { | 555 | 3.00k | // Create a slice from the buffer to make | 556 | 3.00k | // a fat pointer. Then, use Box::from_raw | 557 | 3.00k | // to deallocate it. | 558 | 3.00k | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 3.00k | Box::from_raw(ptr); | 560 | 3.00k | } | 561 | 3.00k | } |
<crossbeam_channel::flavors::array::Channel<()> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 4 | fn drop(&mut self) { | 531 | 4 | // Get the index of the head. | 532 | 4 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 7.53k | for i in 0..self.len()4 { | 536 | | // Compute the index of the next slot holding a message. | 537 | 7.53k | let index = if hix + i < self.cap { | 538 | 7.53k | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 7.53k | unsafe { | 544 | 7.53k | let p = { | 545 | 7.53k | let slot = &mut *self.buffer.add(index); | 546 | 7.53k | let msg = &mut *slot.msg.get(); | 547 | 7.53k | msg.as_mut_ptr() | 548 | 7.53k | }; | 549 | 7.53k | p.drop_in_place(); | 550 | 7.53k | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 4 | unsafe { | 555 | 4 | // Create a slice from the buffer to make | 556 | 4 | // a fat pointer. Then, use Box::from_raw | 557 | 4 | // to deallocate it. | 558 | 4 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 4 | Box::from_raw(ptr); | 560 | 4 | } | 561 | 4 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<std::time::Instant> as core::ops::drop::Drop>::drop <crossbeam_channel::flavors::array::Channel<usize> as core::ops::drop::Drop>::drop Line | Count | Source | 530 | 2 | fn drop(&mut self) { | 531 | 2 | // Get the index of the head. | 532 | 2 | let hix = self.head.load(Ordering::Relaxed) & (self.mark_bit - 1); | 533 | | | 534 | | // Loop over all slots that hold a message and drop them. | 535 | 2 | for i0 in 0..self.len() { | 536 | | // Compute the index of the next slot holding a message. | 537 | 0 | let index = if hix + i < self.cap { | 538 | 0 | hix + i | 539 | | } else { | 540 | 0 | hix + i - self.cap | 541 | | }; | 542 | | | 543 | 0 | unsafe { | 544 | 0 | let p = { | 545 | 0 | let slot = &mut *self.buffer.add(index); | 546 | 0 | let msg = &mut *slot.msg.get(); | 547 | 0 | msg.as_mut_ptr() | 548 | 0 | }; | 549 | 0 | p.drop_in_place(); | 550 | 0 | } | 551 | | } | 552 | | | 553 | | // Finally, deallocate the buffer, but don't run any destructors. | 554 | 2 | unsafe { | 555 | 2 | // Create a slice from the buffer to make | 556 | 2 | // a fat pointer. Then, use Box::from_raw | 557 | 2 | // to deallocate it. | 558 | 2 | let ptr = std::slice::from_raw_parts_mut(self.buffer, self.cap) as *mut [Slot<T>]; | 559 | 2 | Box::from_raw(ptr); | 560 | 2 | } | 561 | 2 | } |
Unexecuted instantiation: <crossbeam_channel::flavors::array::Channel<i32> as core::ops::drop::Drop>::drop |
562 | | } |
563 | | |
564 | | /// Receiver handle to a channel. |
565 | | pub(crate) struct Receiver<'a, T>(&'a Channel<T>); |
566 | | |
567 | | /// Sender handle to a channel. |
568 | | pub(crate) struct Sender<'a, T>(&'a Channel<T>); |
569 | | |
570 | | impl<T> SelectHandle for Receiver<'_, T> { |
571 | 698k | fn try_select(&self, token: &mut Token) -> bool { |
572 | 698k | self.0.start_recv(token) |
573 | 698k | } <crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 2.95k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 2.95k | self.0.start_recv(token) | 573 | 2.95k | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 296k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 296k | self.0.start_recv(token) | 573 | 296k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 8.48k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 8.48k | self.0.start_recv(token) | 573 | 8.48k | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 15.6k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 15.6k | self.0.start_recv(token) | 573 | 15.6k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 19.7k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 19.7k | self.0.start_recv(token) | 573 | 19.7k | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 1 | fn try_select(&self, token: &mut Token) -> bool { | 572 | 1 | self.0.start_recv(token) | 573 | 1 | } |
<crossbeam_channel::flavors::array::Receiver<u8> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 10.0k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 10.0k | self.0.start_recv(token) | 573 | 10.0k | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 27.6k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 27.6k | self.0.start_recv(token) | 573 | 27.6k | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 280k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 280k | self.0.start_recv(token) | 573 | 280k | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 21.5k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 21.5k | self.0.start_recv(token) | 573 | 21.5k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 571 | 14.2k | fn try_select(&self, token: &mut Token) -> bool { | 572 | 14.2k | self.0.start_recv(token) | 573 | 14.2k | } |
|
574 | | |
575 | 0 | fn deadline(&self) -> Option<Instant> { |
576 | 0 | None |
577 | 0 | } |
578 | | |
579 | 9.00k | fn register(&self, oper: Operation, cx: &Context) -> bool { |
580 | 9.00k | self.0.receivers.register(oper, cx); |
581 | 9.00k | self.is_ready() |
582 | 9.00k | } <crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 99 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 99 | self.0.receivers.register(oper, cx); | 581 | 99 | self.is_ready() | 582 | 99 | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 500 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 500 | self.0.receivers.register(oper, cx); | 581 | 500 | self.is_ready() | 582 | 500 | } |
<crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 955 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 955 | self.0.receivers.register(oper, cx); | 581 | 955 | self.is_ready() | 582 | 955 | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 1.39k | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 1.39k | self.0.receivers.register(oper, cx); | 581 | 1.39k | self.is_ready() | 582 | 1.39k | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 5.75k | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 5.75k | self.0.receivers.register(oper, cx); | 581 | 5.75k | self.is_ready() | 582 | 5.75k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 579 | 305 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 580 | 305 | self.0.receivers.register(oper, cx); | 581 | 305 | self.is_ready() | 582 | 305 | } |
|
583 | | |
584 | 9.00k | fn unregister(&self, oper: Operation) { |
585 | 9.00k | self.0.receivers.unregister(oper); |
586 | 9.00k | } <crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 955 | fn unregister(&self, oper: Operation) { | 585 | 955 | self.0.receivers.unregister(oper); | 586 | 955 | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 500 | fn unregister(&self, oper: Operation) { | 585 | 500 | self.0.receivers.unregister(oper); | 586 | 500 | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 99 | fn unregister(&self, oper: Operation) { | 585 | 99 | self.0.receivers.unregister(oper); | 586 | 99 | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 1.38k | fn unregister(&self, oper: Operation) { | 585 | 1.38k | self.0.receivers.unregister(oper); | 586 | 1.38k | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 5.75k | fn unregister(&self, oper: Operation) { | 585 | 5.75k | self.0.receivers.unregister(oper); | 586 | 5.75k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 584 | 305 | fn unregister(&self, oper: Operation) { | 585 | 305 | self.0.receivers.unregister(oper); | 586 | 305 | } |
|
587 | | |
588 | 1.15k | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { |
589 | 1.15k | self.try_select(token) |
590 | 1.15k | } <crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 439 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 439 | self.try_select(token) | 590 | 439 | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 88 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 88 | self.try_select(token) | 590 | 88 | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 4 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 4 | self.try_select(token) | 590 | 4 | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 195 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 195 | self.try_select(token) | 590 | 195 | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 431 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 431 | self.try_select(token) | 590 | 431 | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::accept Line | Count | Source | 588 | 2 | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { | 589 | 2 | self.try_select(token) | 590 | 2 | } |
|
591 | | |
592 | 103k | fn is_ready(&self) -> bool { |
593 | 103k | !self.0.is_empty() || self.0.is_disconnected()41.5k |
594 | 103k | } <crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 500 | fn is_ready(&self) -> bool { | 593 | 500 | !self.0.is_empty() || self.0.is_disconnected()211 | 594 | 500 | } |
<crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 955 | fn is_ready(&self) -> bool { | 593 | 955 | !self.0.is_empty() || self.0.is_disconnected()439 | 594 | 955 | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 99 | fn is_ready(&self) -> bool { | 593 | 99 | !self.0.is_empty() || self.0.is_disconnected()34 | 594 | 99 | } |
<crossbeam_channel::flavors::array::Receiver<i32> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 1.39k | fn is_ready(&self) -> bool { | 593 | 1.39k | !self.0.is_empty() || self.0.is_disconnected()1.13k | 594 | 1.39k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 305 | fn is_ready(&self) -> bool { | 593 | 305 | !self.0.is_empty() || self.0.is_disconnected()135 | 594 | 305 | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 5.75k | fn is_ready(&self) -> bool { | 593 | 5.75k | !self.0.is_empty() || self.0.is_disconnected()2.16k | 594 | 5.75k | } |
<crossbeam_channel::flavors::array::Receiver<usize> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 15.9k | fn is_ready(&self) -> bool { | 593 | 15.9k | !self.0.is_empty() || self.0.is_disconnected()5.96k | 594 | 15.9k | } |
<crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 11.6k | fn is_ready(&self) -> bool { | 593 | 11.6k | !self.0.is_empty() || self.0.is_disconnected()8.64k | 594 | 11.6k | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 592 | 67.2k | fn is_ready(&self) -> bool { | 593 | 67.2k | !self.0.is_empty() || self.0.is_disconnected()22.7k | 594 | 67.2k | } |
|
595 | | |
596 | 6 | fn watch(&self, oper: Operation, cx: &Context) -> bool { |
597 | 6 | self.0.receivers.watch(oper, cx); |
598 | 6 | self.is_ready() |
599 | 6 | } <crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::watch Line | Count | Source | 596 | 5 | fn watch(&self, oper: Operation, cx: &Context) -> bool { | 597 | 5 | self.0.receivers.watch(oper, cx); | 598 | 5 | self.is_ready() | 599 | 5 | } |
<crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::watch Line | Count | Source | 596 | 1 | fn watch(&self, oper: Operation, cx: &Context) -> bool { | 597 | 1 | self.0.receivers.watch(oper, cx); | 598 | 1 | self.is_ready() | 599 | 1 | } |
|
600 | | |
601 | 6 | fn unwatch(&self, oper: Operation) { |
602 | 6 | self.0.receivers.unwatch(oper); |
603 | 6 | } <crossbeam_channel::flavors::array::Receiver<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::unwatch Line | Count | Source | 601 | 1 | fn unwatch(&self, oper: Operation) { | 602 | 1 | self.0.receivers.unwatch(oper); | 603 | 1 | } |
<crossbeam_channel::flavors::array::Receiver<()> as crossbeam_channel::select::SelectHandle>::unwatch Line | Count | Source | 601 | 5 | fn unwatch(&self, oper: Operation) { | 602 | 5 | self.0.receivers.unwatch(oper); | 603 | 5 | } |
|
604 | | } |
605 | | |
606 | | impl<T> SelectHandle for Sender<'_, T> { |
607 | 106k | fn try_select(&self, token: &mut Token) -> bool { |
608 | 106k | self.0.start_send(token) |
609 | 106k | } <crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 2.00k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 2.00k | self.0.start_send(token) | 609 | 2.00k | } |
<crossbeam_channel::flavors::array::Sender<usize> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 20 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 20 | self.0.start_send(token) | 609 | 20 | } |
<crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 4.44k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 4.44k | self.0.start_send(token) | 609 | 4.44k | } |
<crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 3 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 3 | self.0.start_send(token) | 609 | 3 | } |
<crossbeam_channel::flavors::array::Sender<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 1 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 1 | self.0.start_send(token) | 609 | 1 | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any>> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 6 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 6 | self.0.start_send(token) | 609 | 6 | } |
<crossbeam_channel::flavors::array::Sender<bool> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 1 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 1 | self.0.start_send(token) | 609 | 1 | } |
<crossbeam_channel::flavors::array::Sender<i32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 46.9k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 46.9k | self.0.start_send(token) | 609 | 46.9k | } |
<crossbeam_channel::flavors::array::Sender<u32> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 3 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 3 | self.0.start_send(token) | 609 | 3 | } |
<crossbeam_channel::flavors::array::Sender<i64> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 1 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 1 | self.0.start_send(token) | 609 | 1 | } |
<crossbeam_channel::flavors::array::Sender<alloc::string::String> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 1 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 1 | self.0.start_send(token) | 609 | 1 | } |
<crossbeam_channel::flavors::array::Sender<usize> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 20 | fn try_select(&self, token: &mut Token) -> bool { | 608 | 20 | self.0.start_send(token) | 609 | 20 | } |
<crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 9.55k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 9.55k | self.0.start_send(token) | 609 | 9.55k | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 2.00k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 2.00k | self.0.start_send(token) | 609 | 2.00k | } |
<crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::try_select Line | Count | Source | 607 | 42.0k | fn try_select(&self, token: &mut Token) -> bool { | 608 | 42.0k | self.0.start_send(token) | 609 | 42.0k | } |
|
610 | | |
611 | 0 | fn deadline(&self) -> Option<Instant> { |
612 | 0 | None |
613 | 0 | } |
614 | | |
615 | 10.4k | fn register(&self, oper: Operation, cx: &Context) -> bool { |
616 | 10.4k | self.0.senders.register(oper, cx); |
617 | 10.4k | self.is_ready() |
618 | 10.4k | } <crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 615 | 1 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 616 | 1 | self.0.senders.register(oper, cx); | 617 | 1 | self.is_ready() | 618 | 1 | } |
<crossbeam_channel::flavors::array::Sender<i32> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 615 | 10.4k | fn register(&self, oper: Operation, cx: &Context) -> bool { | 616 | 10.4k | self.0.senders.register(oper, cx); | 617 | 10.4k | self.is_ready() | 618 | 10.4k | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any>> as crossbeam_channel::select::SelectHandle>::register Line | Count | Source | 615 | 2 | fn register(&self, oper: Operation, cx: &Context) -> bool { | 616 | 2 | self.0.senders.register(oper, cx); | 617 | 2 | self.is_ready() | 618 | 2 | } |
|
619 | | |
620 | 10.4k | fn unregister(&self, oper: Operation) { |
621 | 10.4k | self.0.senders.unregister(oper); |
622 | 10.4k | } <crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 620 | 1 | fn unregister(&self, oper: Operation) { | 621 | 1 | self.0.senders.unregister(oper); | 622 | 1 | } |
<crossbeam_channel::flavors::array::Sender<i32> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 620 | 10.4k | fn unregister(&self, oper: Operation) { | 621 | 10.4k | self.0.senders.unregister(oper); | 622 | 10.4k | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any>> as crossbeam_channel::select::SelectHandle>::unregister Line | Count | Source | 620 | 2 | fn unregister(&self, oper: Operation) { | 621 | 2 | self.0.senders.unregister(oper); | 622 | 2 | } |
|
623 | | |
624 | 4.47k | fn accept(&self, token: &mut Token, _cx: &Context) -> bool { |
625 | 4.47k | self.try_select(token) |
626 | 4.47k | } |
627 | | |
628 | 13.4k | fn is_ready(&self) -> bool { |
629 | 13.4k | !self.0.is_full() || self.0.is_disconnected()10.0k |
630 | 13.4k | } <crossbeam_channel::flavors::array::Sender<()> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 628 | 1 | fn is_ready(&self) -> bool { | 629 | 1 | !self.0.is_full() || self.0.is_disconnected() | 630 | 1 | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any>> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 628 | 2 | fn is_ready(&self) -> bool { | 629 | 2 | !self.0.is_full() || self.0.is_disconnected() | 630 | 2 | } |
<crossbeam_channel::flavors::array::Sender<i32> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 628 | 10.4k | fn is_ready(&self) -> bool { | 629 | 10.4k | !self.0.is_full() || self.0.is_disconnected()10.0k | 630 | 10.4k | } |
<crossbeam_channel::flavors::array::Sender<usize> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 628 | 20 | fn is_ready(&self) -> bool { | 629 | 20 | !self.0.is_full() || self.0.is_disconnected()0 | 630 | 20 | } |
<crossbeam_channel::flavors::array::Sender<alloc::boxed::Box<dyn core::any::Any + core::marker::Send>> as crossbeam_channel::select::SelectHandle>::is_ready Line | Count | Source | 628 | 3.00k | fn is_ready(&self) -> bool { | 629 | 3.00k | !self.0.is_full() || self.0.is_disconnected()0 | 630 | 3.00k | } |
|
631 | | |
632 | 0 | fn watch(&self, oper: Operation, cx: &Context) -> bool { |
633 | 0 | self.0.senders.watch(oper, cx); |
634 | 0 | self.is_ready() |
635 | 0 | } |
636 | | |
637 | 0 | fn unwatch(&self, oper: Operation) { |
638 | 0 | self.0.senders.unwatch(oper); |
639 | 0 | } |
640 | | } |