From a26ec72275db3a44ee3ec32011e7eba53d0b245c Mon Sep 17 00:00:00 2001 From: Jan Niehusmann Date: Wed, 14 Sep 2022 08:51:23 +0000 Subject: [PATCH] Add a sentence about ordering guarantees to doc comment. --- src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 7d13b91..6b26725 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -170,6 +170,9 @@ impl RestoreState { /// - `acquire`/`release` pairs must be "properly nested", ie it's not OK to do `a=acquire(); b=acquire(); release(a); release(b);`. /// - It is UB to call `release` if the critical section is not acquired in the current thread. /// - It is UB to call `release` with a "restore state" that does not come from the corresponding `acquire` call. +/// - It must provide ordering guarantees at least equivalent to a [`core::sync::atomic::Ordering::Acquire`] +/// on a memory location shared by all critical sections, on which the `release` call will do a +/// [`core::sync::atomic::Ordering::Release`] operation. #[inline(always)] pub unsafe fn acquire() -> RestoreState { extern "Rust" {