about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorGeorgii Rylov <g0dj4n@gmail.com>2023-08-16 11:19:22 +0100
committerGeorgii Rylov <g0dj4n@gmail.com>2023-08-16 11:21:06 +0100
commit9b00e5f06f51703c5294af602959d3f92c095aa7 (patch)
treed57bfa67d01bd1892a112e7fc7305722b4127900 /library/std/src/sys
parent42a708083a59ece9599723f69536ddb6e987e6e4 (diff)
downloadrust-9b00e5f06f51703c5294af602959d3f92c095aa7.tar.gz
rust-9b00e5f06f51703c5294af602959d3f92c095aa7.zip
address comments
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/wasi/thread.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/library/std/src/sys/wasi/thread.rs b/library/std/src/sys/wasi/thread.rs
index 99717613f57..a0eefa8811a 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<NonZeroUsize> {
     unsupported()
 }