We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
sync::mpsc
1 parent 7b721ed commit 8dddb22Copy full SHA for 8dddb22
library/std/src/sync/mpmc/utils.rs
@@ -110,7 +110,8 @@ impl Backoff {
110
/// progress.
111
#[inline]
112
pub fn spin(&self) {
113
- for _ in 0..1 << self.step.get().min(SPIN_LIMIT) {
+ let step = self.step.get().min(SPIN_LIMIT);
114
+ for _ in 0..step.pow(2) {
115
crate::hint::spin_loop();
116
}
117
@@ -123,7 +124,7 @@ impl Backoff {
123
124
125
pub fn snooze(&self) {
126
if self.step.get() <= SPIN_LIMIT {
- for _ in 0..1 << self.step.get() {
127
+ for _ in 0..self.step.get().pow(2) {
128
crate::hint::spin_loop()
129
130
} else {
0 commit comments