about summary refs log tree commit diff
diff options
context:
space:
mode:
authorStjepan Glavina <stjepang@gmail.com>2017-11-22 00:00:01 +0100
committerStjepan Glavina <stjepang@gmail.com>2017-11-22 00:00:01 +0100
commit6ceb5f4bec83b525c5df409559272f0e10863f6a (patch)
tree47a8eb5631377b6b4514c49b36a644beaa53fc36
parentb1409af73d133f513980ccbf27c941a28d8d5c50 (diff)
downloadrust-6ceb5f4bec83b525c5df409559272f0e10863f6a.tar.gz
rust-6ceb5f4bec83b525c5df409559272f0e10863f6a.zip
Stabilize spin_loop_hint
-rw-r--r--src/doc/unstable-book/src/library-features/spin-loop-hint.md (renamed from src/doc/unstable-book/src/library-features/hint-core-should-pause.md)8
-rw-r--r--src/libcore/sync/atomic.rs5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/doc/unstable-book/src/library-features/hint-core-should-pause.md b/src/doc/unstable-book/src/library-features/spin-loop-hint.md
index 05e057be493..cd33f0c5e02 100644
--- a/src/doc/unstable-book/src/library-features/hint-core-should-pause.md
+++ b/src/doc/unstable-book/src/library-features/spin-loop-hint.md
@@ -1,4 +1,4 @@
-# `hint_core_should_pause`
+# `spin_loop_hint`
 
 The tracking issue for this feature is: [#41196]
 
@@ -23,7 +23,7 @@ fn spin_loop(value: &AtomicBool) {
 These programs can be improved in performance like so:
 
 ```rust,no_run
-#![feature(hint_core_should_pause)]
+#![feature(spin_loop_hint)]
 use std::sync::atomic;
 use std::sync::atomic::{AtomicBool,Ordering};
 
@@ -32,10 +32,10 @@ fn spin_loop(value: &AtomicBool) {
         if value.load(Ordering::Acquire) {
              break;
         }
-        atomic::hint_core_should_pause();
+        atomic::spin_loop_hint();
     }
 }
 ```
 
-Further improvements could combine `hint_core_should_pause` with
+Further improvements could combine `spin_loop_hint` with
 exponential backoff or `std::thread::yield_now`.
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index b7cf6d778a2..5486cb29266 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -103,9 +103,8 @@ use fmt;
 ///
 /// On some platforms this function may not do anything at all.
 #[inline]
-#[unstable(feature = "hint_core_should_pause", issue = "41196")]
-pub fn hint_core_should_pause()
-{
+#[stable(feature = "spin_loop_hint", since = "1.23.0")]
+pub fn spin_loop_hint() {
     #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
     unsafe {
         asm!("pause" ::: "memory" : "volatile");