sync::mpsc
: reload state after spinning on CAS failure
This commit is contained in:
parent
8c17a3e7cb
commit
7b721ed0cd
@ -167,9 +167,9 @@ impl<T> Channel<T> {
|
||||
token.array.stamp = tail + 1;
|
||||
return true;
|
||||
}
|
||||
Err(t) => {
|
||||
tail = t;
|
||||
Err(_) => {
|
||||
backoff.spin();
|
||||
tail = self.load(Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
} else if stamp.wrapping_add(self.one_lap) == tail + 1 {
|
||||
@ -251,8 +251,8 @@ impl<T> Channel<T> {
|
||||
return true;
|
||||
}
|
||||
Err(h) => {
|
||||
head = h;
|
||||
backoff.spin();
|
||||
head = self.head.load(Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
} else if stamp == head {
|
||||
|
@ -246,10 +246,10 @@ impl<T> Channel<T> {
|
||||
token.list.offset = offset;
|
||||
return true;
|
||||
},
|
||||
Err(t) => {
|
||||
tail = t;
|
||||
block = self.tail.block.load(Ordering::Acquire);
|
||||
Err(_) => {
|
||||
backoff.spin();
|
||||
tail = self.tail.index.load(Ordering::Acquire);
|
||||
block = self.tail.block.load(Ordering::Acquire);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -351,9 +351,9 @@ impl<T> Channel<T> {
|
||||
return true;
|
||||
},
|
||||
Err(h) => {
|
||||
head = h;
|
||||
block = self.head.block.load(Ordering::Acquire);
|
||||
backoff.spin();
|
||||
head = self.head.index.load(Ordering::Acquire);
|
||||
block = self.head.block.load(Ordering::Acquire);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user