From 34b65db8420ecfec94126483c7c170c270fd2ead Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 15 Aug 2018 15:22:54 +0200 Subject: [PATCH 1/2] document effect of join on memory ordering --- src/libstd/thread/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index 61c6084a25023..b580b1ec510b7 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1308,13 +1308,17 @@ impl JoinHandle { &self.0.thread } - /// Waits for the associated thread to finish. + /// Waits for the associated thread to finish. In terms of [atomic memory orderings], + /// the completion of the associated thread synchronizes with this function returning. + /// In other words, all operations performed by that thread are ordered before all + /// operations that happen after `join` returns. /// /// If the child thread panics, [`Err`] is returned with the parameter given /// to [`panic`]. /// /// [`Err`]: ../../std/result/enum.Result.html#variant.Err /// [`panic`]: ../../std/macro.panic.html + /// [atomic memory orderings]: ../../std/sync/atomic/index.html /// /// # Panics /// From 31b63d0ca8b117217c1612826a7ce2786b509c6c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 28 Aug 2018 10:49:45 +0200 Subject: [PATCH 2/2] split paragraph --- src/libstd/thread/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs index b580b1ec510b7..a7c7dbb1b4027 100644 --- a/src/libstd/thread/mod.rs +++ b/src/libstd/thread/mod.rs @@ -1308,9 +1308,11 @@ impl JoinHandle { &self.0.thread } - /// Waits for the associated thread to finish. In terms of [atomic memory orderings], - /// the completion of the associated thread synchronizes with this function returning. - /// In other words, all operations performed by that thread are ordered before all + /// Waits for the associated thread to finish. + /// + /// In terms of [atomic memory orderings], the completion of the associated + /// thread synchronizes with this function returning. In other words, all + /// operations performed by that thread are ordered before all /// operations that happen after `join` returns. /// /// If the child thread panics, [`Err`] is returned with the parameter given