Correctly constrain BucketStorage Header's memory ordering (#20507)

This commit is contained in:
Brooks Prumo
2021-10-07 13:32:40 -05:00
committed by GitHub
parent 0ebd8c53ee
commit 839edd35a4

View File

@ -46,13 +46,13 @@ impl Header {
Ok(UID_UNLOCKED) Ok(UID_UNLOCKED)
== self == self
.lock .lock
.compare_exchange(UID_UNLOCKED, uid, Ordering::Acquire, Ordering::Relaxed) .compare_exchange(UID_UNLOCKED, uid, Ordering::AcqRel, Ordering::Relaxed)
} }
fn unlock(&self) -> Uid { fn unlock(&self) -> Uid {
self.lock.swap(UID_UNLOCKED, Ordering::Release) self.lock.swap(UID_UNLOCKED, Ordering::Release)
} }
fn uid(&self) -> Uid { fn uid(&self) -> Uid {
self.lock.load(Ordering::Relaxed) self.lock.load(Ordering::Acquire)
} }
} }