6
6
//!
7
7
//! [spec]: https://github.com/WebAssembly/threads
8
8
9
- #![ cfg( any( target_feature = "atomics" , doc) ) ]
10
-
11
9
#[ cfg( test) ]
12
10
use stdarch_test:: assert_instr;
13
11
@@ -43,14 +41,16 @@ extern "C" {
43
41
///
44
42
/// # Availability
45
43
///
46
- /// This intrinsic is only available **when the standard library itself is
47
- /// compiled with the `atomics` target feature**. This version of the standard
48
- /// library is not obtainable via `rustup`, but rather will require the
49
- /// standard library to be compiled from source.
44
+ /// This intrinsic is always available in the standard library but it will not
45
+ /// work as expected with the precompiled versions of the standard library. The
46
+ /// standard library must be compiled with `-Ctarget-feature=+atomics` to have
47
+ /// the wasm module use shared memory which makes this intrinsic more useful.
48
+ /// The standard library is not compiled with this flag by default.
50
49
///
51
50
/// [instr]: https://webassembly.github.io/threads/syntax/instructions.html#syntax-instr-atomic-memory
52
51
#[ inline]
53
52
#[ cfg_attr( test, assert_instr( "i32.atomic.wait" ) ) ]
53
+ #[ stable( feature = "wasm_atomics" , since = "1.50.0" ) ]
54
54
pub unsafe fn memory_atomic_wait32 ( ptr : * mut i32 , expression : i32 , timeout_ns : i64 ) -> i32 {
55
55
llvm_atomic_wait_i32 ( ptr, expression, timeout_ns)
56
56
}
@@ -78,14 +78,16 @@ pub unsafe fn memory_atomic_wait32(ptr: *mut i32, expression: i32, timeout_ns: i
78
78
///
79
79
/// # Availability
80
80
///
81
- /// This intrinsic is only available **when the standard library itself is
82
- /// compiled with the `atomics` target feature**. This version of the standard
83
- /// library is not obtainable via `rustup`, but rather will require the
84
- /// standard library to be compiled from source.
81
+ /// This intrinsic is always available in the standard library but it will not
82
+ /// work as expected with the precompiled versions of the standard library. The
83
+ /// standard library must be compiled with `-Ctarget-feature=+atomics` to have
84
+ /// the wasm module use shared memory which makes this intrinsic more useful.
85
+ /// The standard library is not compiled with this flag by default.
85
86
///
86
87
/// [instr]: https://webassembly.github.io/threads/syntax/instructions.html#syntax-instr-atomic-memory
87
88
#[ inline]
88
89
#[ cfg_attr( test, assert_instr( "i64.atomic.wait" ) ) ]
90
+ #[ stable( feature = "wasm_atomics" , since = "1.50.0" ) ]
89
91
pub unsafe fn memory_atomic_wait64 ( ptr : * mut i64 , expression : i64 , timeout_ns : i64 ) -> i32 {
90
92
llvm_atomic_wait_i64 ( ptr, expression, timeout_ns)
91
93
}
@@ -105,14 +107,16 @@ pub unsafe fn memory_atomic_wait64(ptr: *mut i64, expression: i64, timeout_ns: i
105
107
///
106
108
/// # Availability
107
109
///
108
- /// This intrinsic is only available **when the standard library itself is
109
- /// compiled with the `atomics` target feature**. This version of the standard
110
- /// library is not obtainable via `rustup`, but rather will require the
111
- /// standard library to be compiled from source.
110
+ /// This intrinsic is always available in the standard library but it will not
111
+ /// work as expected with the precompiled versions of the standard library. The
112
+ /// standard library must be compiled with `-Ctarget-feature=+atomics` to have
113
+ /// the wasm module use shared memory which makes this intrinsic more useful.
114
+ /// The standard library is not compiled with this flag by default.
112
115
///
113
116
/// [instr]: https://webassembly.github.io/threads/syntax/instructions.html#syntax-instr-atomic-memory
114
117
#[ inline]
115
118
#[ cfg_attr( test, assert_instr( "atomic.wake" ) ) ]
119
+ #[ stable( feature = "wasm_atomics" , since = "1.50.0" ) ]
116
120
pub unsafe fn memory_atomic_notify ( ptr : * mut i32 , waiters : u32 ) -> u32 {
117
121
llvm_atomic_notify ( ptr, waiters as i32 ) as u32
118
122
}
0 commit comments