@@ -893,7 +893,8 @@ pub fn sleep(dur: Duration) {
893
893
///
894
894
/// Note that being unblocked does not imply a call was made to `unpark`, because
895
895
/// wakeups can also be spurious. For example, a valid, but inefficient,
896
- /// implementation could have `park` and `unpark` return immediately without doing anything.
896
+ /// implementation could have `park` and `unpark` return immediately without doing anything,
897
+ /// making *all* wakeups spurious.
897
898
///
898
899
/// # Examples
899
900
///
@@ -908,7 +909,7 @@ pub fn sleep(dur: Duration) {
908
909
/// let parked_thread = thread::spawn(move || {
909
910
/// // We want to wait until the flag is set. We *could* just spin, but using
910
911
/// // park/unpark is more efficient.
911
- /// while !flag2.load(Ordering::Acquire ) {
912
+ /// while !flag2.load(Ordering::Relaxed ) {
912
913
/// println!("Parking thread");
913
914
/// thread::park();
914
915
/// // We *could* get here spuriously, i.e., way before the 10ms below are over!
@@ -925,7 +926,7 @@ pub fn sleep(dur: Duration) {
925
926
/// // There is no race condition here, if `unpark`
926
927
/// // happens first, `park` will return immediately.
927
928
/// // Hence there is no risk of a deadlock.
928
- /// flag.store(true, Ordering::Release );
929
+ /// flag.store(true, Ordering::Relaxed );
929
930
/// println!("Unpark the thread");
930
931
/// parked_thread.thread().unpark();
931
932
///
0 commit comments