diff --git a/library/std/src/sys/thread/unix.rs b/library/std/src/sys/thread/unix.rs index 6f23c28c04d6a..430e699e098e6 100644 --- a/library/std/src/sys/thread/unix.rs +++ b/library/std/src/sys/thread/unix.rs @@ -49,7 +49,10 @@ impl Thread { // WASI does not support threading via pthreads. While wasi-libc provides // pthread stubs, pthread_create returns EAGAIN, which causes confusing // errors. We return UNSUPPORTED_PLATFORM directly instead. - if cfg!(target_os = "wasi") { + + // NOTE: exempt `wasm32-wasip1-threads` from this check as `emnapi` has a working pthread + // implementation. See . + if cfg!(all(target_os = "wasi", not(all(target_env = "p1", target_feature = "atomics")))) { return Err(io::Error::UNSUPPORTED_PLATFORM); }