From ed4c05e5971ad48d8df08e83360e7ddc0871772a Mon Sep 17 00:00:00 2001 From: inrustwetrust Date: Tue, 28 Apr 2015 21:07:21 +0200 Subject: [PATCH] Clarify Once::call_once memory ordering guarantees in docs --- src/libstd/sync/once.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 2ce974c1271aa..2d7123692289d 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -59,7 +59,11 @@ impl Once { /// routine is currently running. /// /// When this function returns, it is guaranteed that some initialization - /// has run and completed (it may not be the closure specified). + /// has run and completed (it may not be the closure specified). It is also + /// guaranteed that any memory writes performed by the executed closure can + /// be reliably observed by other tasks at this point (there is a + /// happens-before relation between the closure and code executing after the + /// return). #[stable(feature = "rust1", since = "1.0.0")] pub fn call_once(&'static self, f: F) where F: FnOnce() { // Optimize common path: load is much cheaper than fetch_add.