We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 60713f4 commit 42a7080Copy full SHA for 42a7080
library/std/src/sys/wasi/thread.rs
@@ -47,6 +47,7 @@ cfg_if::cfg_if! {
47
stack_size: libc::size_t,
48
) -> ffi::c_int;
49
pub fn pthread_attr_destroy(attr: *mut pthread_attr_t) -> ffi::c_int;
50
+ pub fn pthread_detach(thread: pthread_t) -> ffi::c_int;
51
}
52
53
@@ -178,6 +179,17 @@ impl Thread {
178
179
180
181
182
+cfg_if::cfg_if! {
183
+ if #[cfg(target_feature = "atomics")] {
184
+ impl Drop for Thread {
185
+ fn drop(&mut self) {
186
+ let ret = unsafe { libc::pthread_detach(self.id) };
187
+ debug_assert_eq!(ret, 0);
188
+ }
189
190
191
+}
192
+
193
pub fn available_parallelism() -> io::Result<NonZeroUsize> {
194
unsupported()
195
0 commit comments