tidy
This commit is contained in:
@@ -169,7 +169,7 @@ impl<T> Channel<T> {
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
backoff.spin();
|
backoff.spin();
|
||||||
tail = self.load(Ordering::Relaxed);
|
tail = self.tail.load(Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if stamp.wrapping_add(self.one_lap) == tail + 1 {
|
} else if stamp.wrapping_add(self.one_lap) == tail + 1 {
|
||||||
@@ -250,7 +250,7 @@ impl<T> Channel<T> {
|
|||||||
token.array.stamp = head.wrapping_add(self.one_lap);
|
token.array.stamp = head.wrapping_add(self.one_lap);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Err(h) => {
|
Err(_) => {
|
||||||
backoff.spin();
|
backoff.spin();
|
||||||
head = self.head.load(Ordering::Relaxed);
|
head = self.head.load(Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
//! Thread-local channel context.
|
//! Thread-local channel context.
|
||||||
|
|
||||||
use super::select::Selected;
|
use super::select::Selected;
|
||||||
use super::utils::Backoff;
|
|
||||||
|
|
||||||
use crate::cell::Cell;
|
use crate::cell::Cell;
|
||||||
use crate::ptr;
|
use crate::ptr;
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ impl<T> Channel<T> {
|
|||||||
token.list.offset = offset;
|
token.list.offset = offset;
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
Err(h) => {
|
Err(_) => {
|
||||||
backoff.spin();
|
backoff.spin();
|
||||||
head = self.head.index.load(Ordering::Acquire);
|
head = self.head.index.load(Ordering::Acquire);
|
||||||
block = self.head.block.load(Ordering::Acquire);
|
block = self.head.block.load(Ordering::Acquire);
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ impl Backoff {
|
|||||||
#[inline]
|
#[inline]
|
||||||
pub fn spin(&self) {
|
pub fn spin(&self) {
|
||||||
let step = self.step.get().min(SPIN_LIMIT);
|
let step = self.step.get().min(SPIN_LIMIT);
|
||||||
for _ in 0..step.pow(2) {
|
for _ in 0..step.pow(2) {
|
||||||
crate::hint::spin_loop();
|
crate::hint::spin_loop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user