diff options
author | walkingeyerobot <mitch@thefoley.net> | 2024-02-06 17:26:12 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 22:26:12 +0000 |
commit | 0388727827064172ba49ca222fc221a1be4a3694 (patch) | |
tree | f8489bc586ccdc3a1fe46e6d061ac132ddec22ee | |
parent | d5666098d1af5f5929babacb6a7ad7d1a54ed984 (diff) | |
download | wabt-0388727827064172ba49ca222fc221a1be4a3694.tar.gz wabt-0388727827064172ba49ca222fc221a1be4a3694.tar.bz2 wabt-0388727827064172ba49ca222fc221a1be4a3694.zip |
Fallback to pthreads if threads aren't available (#2385)
-rw-r--r-- | wasm2c/wasm-rt.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/wasm2c/wasm-rt.h b/wasm2c/wasm-rt.h index 32a29c98..f06748eb 100644 --- a/wasm2c/wasm-rt.h +++ b/wasm2c/wasm-rt.h @@ -58,19 +58,19 @@ extern "C" { #endif /** - * Apple and Windows devices don't implement the C11 threads.h. We use pthreads - * on Apple devices, and CriticalSection APIs for Windows. + * Many devices don't implement the C11 threads.h. We use CriticalSection APIs + * for Windows and pthreads on other platforms where threads are not available. */ #ifdef WASM_RT_C11_AVAILABLE -#ifdef __APPLE__ -#include <pthread.h> -#define WASM_RT_MUTEX pthread_mutex_t -#define WASM_RT_USE_PTHREADS 1 -#elif defined(_WIN32) +#if defined(_WIN32) #include <windows.h> #define WASM_RT_MUTEX CRITICAL_SECTION #define WASM_RT_USE_CRITICALSECTION 1 +#elif defined(__APPLE__) || defined(__STDC_NO_THREADS__) +#include <pthread.h> +#define WASM_RT_MUTEX pthread_mutex_t +#define WASM_RT_USE_PTHREADS 1 #else #include <threads.h> #define WASM_RT_MUTEX mtx_t |