File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
doc/unstable-book/src/library-features Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
- # ` hint_core_should_pause `
1
+ # ` spin_loop_hint `
2
2
3
3
The tracking issue for this feature is: [ #41196 ]
4
4
@@ -23,7 +23,7 @@ fn spin_loop(value: &AtomicBool) {
23
23
These programs can be improved in performance like so:
24
24
25
25
``` rust,no_run
26
- #![feature(hint_core_should_pause )]
26
+ #![feature(spin_loop_hint )]
27
27
use std::sync::atomic;
28
28
use std::sync::atomic::{AtomicBool,Ordering};
29
29
@@ -32,10 +32,10 @@ fn spin_loop(value: &AtomicBool) {
32
32
if value.load(Ordering::Acquire) {
33
33
break;
34
34
}
35
- atomic::hint_core_should_pause ();
35
+ atomic::spin_loop_hint ();
36
36
}
37
37
}
38
38
```
39
39
40
- Further improvements could combine ` hint_core_should_pause ` with
40
+ Further improvements could combine ` spin_loop_hint ` with
41
41
exponential backoff or ` std::thread::yield_now ` .
Original file line number Diff line number Diff line change @@ -103,9 +103,8 @@ use fmt;
103
103
///
104
104
/// On some platforms this function may not do anything at all.
105
105
#[ inline]
106
- #[ unstable( feature = "hint_core_should_pause" , issue = "41196" ) ]
107
- pub fn hint_core_should_pause ( )
108
- {
106
+ #[ stable( feature = "spin_loop_hint" , since = "1.23.0" ) ]
107
+ pub fn spin_loop_hint ( ) {
109
108
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
110
109
unsafe {
111
110
asm ! ( "pause" :: : "memory" : "volatile" ) ;
You can’t perform that action at this time.
0 commit comments