You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor stub pthread library and enable unconditionally.
This commit changes the layout of the stub pthread library to match
that of libc-top-half: splits it into (mostly) one file per function,
and ensures the same API is exposed from both libraries, adding stub
functions as necessary.
This commit also removes `-lwasi-emulated-pthread` as well as
`-D_WASI_EMULATED_PTHREAD` and enables this functionality
unconditionally, seeing as this is necessary for building libc++ with
threading enabled.
It adds a flag `-D_WASI_STRICT_PTHREAD` that causes thread creation
functions (`pthread_create`, `pthread_detach`, `pthread_join`) to
be defined as a macro causing a compile error, which can be used to
locate the parts of a codebase requiring changes for the single thread
model.
Specifically, after this commit, the two targets `wasm32-wasip1` and
`wasm32-wasip1-threads` differ as follows (cleaned up for clarity):
--- expected/wasm32-wasip1/defined-symbols.txt
+++ expected/wasm32-wasip1-threads/defined-symbols.txt
+flockfile
+ftrylockfile
+funlockfile
+sem_destroy
+sem_getvalue
+sem_init
+sem_post
+sem_timedwait
+sem_trywait
+sem_wait
+thrd_detach
+wasi_thread_start
--- expected/wasm32-wasip1/predefined-macros.txt
+++ expected/wasm32-wasip1-threads/predefined-macros.txt
+#define _REENTRANT 1
+#define SEM_NSEMS_MAX 256
+#define SEM_VALUE_MAX 0x7fffffff
+#define __wasm_atomics__ 1
+#define __wasm_bulk_memory__ 1
0 commit comments