diff --git a/library/std/src/sys/wasi/thread.rs b/library/std/src/sys/wasi/thread.rs index 99717613f57cf..a0eefa8811a39 100644 --- a/library/std/src/sys/wasi/thread.rs +++ b/library/std/src/sys/wasi/thread.rs @@ -54,6 +54,13 @@ cfg_if::cfg_if! { pub struct Thread { id: libc::pthread_t, } + + impl Drop for Thread { + fn drop(&mut self) { + let ret = unsafe { libc::pthread_detach(self.id) }; + debug_assert_eq!(ret, 0); + } + } } else { pub struct Thread(!); } @@ -179,17 +186,6 @@ impl Thread { } } -cfg_if::cfg_if! { - if #[cfg(target_feature = "atomics")] { - impl Drop for Thread { - fn drop(&mut self) { - let ret = unsafe { libc::pthread_detach(self.id) }; - debug_assert_eq!(ret, 0); - } - } - } -} - pub fn available_parallelism() -> io::Result { unsupported() }