]> git.ipfire.org Git - thirdparty/xz.git/commitdiff
mythread.h: Fix the build on Emscripten when threading is disabled
authorLasse Collin <lasse.collin@tukaani.org>
Mon, 3 Nov 2025 10:41:31 +0000 (12:41 +0200)
committerLasse Collin <lasse.collin@tukaani.org>
Mon, 3 Nov 2025 12:48:15 +0000 (14:48 +0200)
To make a non-threaded liblzma-only build work with WASI SDK, <signal.h>
and mythread_sigmask() were omitted from mythread.h in the commit
81db3b889830. This broke non-threaded full build with Emscripten because
src/xz/signals.c needs mythread_sigmask() (liblzma-only build was fine).

If __wasm__ is defined, omit <signal.h> and mythread_sigmask() in
non-threaded builds only when __EMSCRIPTEN__ isn't defined.

Reported-by: Marcus Tillmanns
Thanks-to: ChanTsune
Fixes: https://github.com/tukaani-project/xz/issues/161
Fixes: 81db3b889830 ("mythread.h: Disable signal functions in builds targeting Wasm + WASI.")
src/common/mythread.h

index 10ea2d42c24d56ffa11849ff13aeab2b777d41d6..bec69b4487cb161d6489573eab395d83c4c3c627 100644 (file)
@@ -78,7 +78,8 @@ do { \
 } while (0)
 
 
-#if !(defined(_WIN32) && !defined(__CYGWIN__)) && !defined(__wasm__)
+#if !(defined(_WIN32) && !defined(__CYGWIN__)) \
+               && (!defined(__wasm__) || defined(__EMSCRIPTEN__))
 // Use sigprocmask() to set the signal mask in single-threaded programs.
 #include <signal.h>