Implement pthread_cond_broadcast wrapper for lib-pthread (#982)
Implement pthread_cond_broadcast wrapper for lib-pthread - support pthread_cond_broadcast wrapper for posix/linux-sgx/windows - update document for building multi-thread wasm app with emcc
This commit is contained in:
@ -80,8 +80,17 @@ Then build the program with this command:
|
||||
|
||||
**Build with EMCC**
|
||||
|
||||
> Note: This document is based on `emcc 2.0.26`, other version may not work with these commands
|
||||
|
||||
EMCC's `-pthread` option is not compatible with standalone mode, we need to pass `-mbulk-memory -matomics` to the compiler and `--shared-memory,--no-check-features` to linker manually
|
||||
|
||||
EMCC provides some empty implementation for pthread related APIs, we need to remove them from emcc's libc.
|
||||
``` bash
|
||||
cd ${emsdk_dir}/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten
|
||||
emar d libc.a library_pthread_stub.o
|
||||
emranlib libc.a
|
||||
```
|
||||
|
||||
``` bash
|
||||
emcc -O3 -mbulk-memory -matomics -s MALLOC="none" \
|
||||
-Wl,--export=__data_end,--export=__heap_base \
|
||||
@ -166,6 +175,8 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
|
||||
int pthread_cond_signal(pthread_cond_t *cond);
|
||||
|
||||
int pthread_cond_broadcast(pthread_cond_t *cond);
|
||||
|
||||
int pthread_cond_destroy(pthread_cond_t *cond);
|
||||
|
||||
/* Pthread key APIs */
|
||||
|
||||
Reference in New Issue
Block a user