Use a simpler atomic operation than the compare_exchange
hammer
This commit is contained in:
parent
300901b705
commit
54214c8d8d
2 changed files with 9 additions and 3 deletions
|
@ -107,6 +107,14 @@ cfg_if! {
|
|||
}
|
||||
}
|
||||
|
||||
impl Atomic<bool> {
|
||||
pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
|
||||
let result = self.0.get() | val;
|
||||
self.0.set(val);
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy + PartialEq> Atomic<T> {
|
||||
#[inline]
|
||||
pub fn compare_exchange(&self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue