summaryrefslogtreecommitdiffstats
path: root/tokio/src/sync/broadcast.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/sync/broadcast.rs')
-rw-r--r--tokio/src/sync/broadcast.rs18
1 files changed, 8 insertions, 10 deletions
diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs
index 093aa1f3..fd9029a7 100644
--- a/tokio/src/sync/broadcast.rs
+++ b/tokio/src/sync/broadcast.rs
@@ -109,8 +109,8 @@
use crate::loom::cell::CausalCell;
use crate::loom::future::AtomicWaker;
-use crate::loom::sync::{Mutex, Arc, Condvar};
-use crate::loom::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize, spin_loop_hint};
+use crate::loom::sync::atomic::{spin_loop_hint, AtomicBool, AtomicPtr, AtomicUsize};
+use crate::loom::sync::{Arc, Condvar, Mutex};
use std::fmt;
use std::ptr;
@@ -387,10 +387,7 @@ pub fn channel<T>(mut capacity: usize) -> (Sender<T>, Receiver<T>) {
let shared = Arc::new(Shared {
buffer: buffer.into_boxed_slice(),
mask: capacity - 1,
- tail: Mutex::new(Tail {
- pos: 0,
- rx_cnt: 1,
- }),
+ tail: Mutex::new(Tail { pos: 0, rx_cnt: 1 }),
condvar: Condvar::new(),
wait_stack: AtomicPtr::new(ptr::null_mut()),
num_tx: AtomicUsize::new(1),
@@ -406,9 +403,7 @@ pub fn channel<T>(mut capacity: usize) -> (Sender<T>, Receiver<T>) {
}),
};
- let tx = Sender {
- shared,
- };
+ let tx = Sender { shared };
(tx, rx)
}
@@ -852,7 +847,10 @@ where
// access to `self.wait.next`.
self.wait.next.with_mut(|ptr| unsafe { *ptr = curr });
- let res = self.shared.wait_stack.compare_exchange(curr, node, SeqCst, SeqCst);
+ let res = self
+ .shared
+ .wait_stack
+ .compare_exchange(curr, node, SeqCst, SeqCst);
match res {
Ok(_) => return,