Skip to content

Commit 355ec42

Browse files
committed
fixup! match cutils.h guard
1 parent a74a6fa commit 355ec42

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

cutils.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,13 @@ static inline size_t js__malloc_usable_size(const void *ptr)
563563

564564
/* Cross-platform threading APIs. */
565565

566-
#if !defined(EMSCRIPTEN) && !defined(__wasi__)
566+
#if defined(EMSCRIPTEN) || defined(__wasi__)
567+
568+
#define JS_HAVE_THREADS 0
569+
570+
#else
571+
572+
#define JS_HAVE_THREADS 1
567573

568574
#if defined(_WIN32)
569575
#define JS_ONCE_INIT INIT_ONCE_STATIC_INIT

quickjs-libc.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,18 @@ extern char **environ;
8080

8181
#endif /* _WIN32 */
8282

83-
#if !defined(__wasi__)
84-
/* enable the os.Worker API. IT relies on POSIX threads */
85-
#define USE_WORKER
83+
#include "cutils.h"
84+
#include "list.h"
85+
#include "quickjs-libc.h"
86+
87+
#if JS_HAVE_THREADS
88+
#define USE_WORKER // enable os.Worker
8689
#endif
8790

8891
#ifdef USE_WORKER
8992
#include "quickjs-c-atomics.h"
9093
#endif
9194

92-
#include "cutils.h"
93-
#include "list.h"
94-
#include "quickjs-libc.h"
95-
9695
#ifndef MAX_SAFE_INTEGER // already defined in amalgamation builds
9796
#define MAX_SAFE_INTEGER (((int64_t) 1 << 53) - 1)
9897
#endif

0 commit comments

Comments
 (0)