diff options
author | Carl Lerche <me@carllerche.com> | 2020-05-12 15:09:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-12 15:09:43 -0700 |
commit | fb7dfcf4322b5e60604815aea91266b88f0b7823 (patch) | |
tree | aeba04a918be8a00eb09f6001a4f7946bd188c66 /tokio/src/loom | |
parent | a32f918671ef641affbfcc4d4005ab738da795df (diff) |
sync: use intrusive list strategy for broadcast (#2509)
Previously, in the broadcast channel, receiver wakers were passed to the
sender via an atomic stack with allocated nodes. When a message was
sent, the stack was drained. This caused a problem when many receivers
pushed a waiter node then dropped. The waiter node remained indefinitely
in cases where no values were sent.
This patch switches broadcast to use the intrusive linked-list waiter
strategy used by `Notify` and `Semaphore.
Diffstat (limited to 'tokio/src/loom')
-rw-r--r-- | tokio/src/loom/std/atomic_ptr.rs | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/tokio/src/loom/std/atomic_ptr.rs b/tokio/src/loom/std/atomic_ptr.rs index eb8e4755..f7fd56cc 100644 --- a/tokio/src/loom/std/atomic_ptr.rs +++ b/tokio/src/loom/std/atomic_ptr.rs @@ -11,10 +11,6 @@ impl<T> AtomicPtr<T> { let inner = std::sync::atomic::AtomicPtr::new(ptr); AtomicPtr { inner } } - - pub(crate) fn with_mut<R>(&mut self, f: impl FnOnce(&mut *mut T) -> R) -> R { - f(self.inner.get_mut()) - } } impl<T> Deref for AtomicPtr<T> { |