wasm-micro-runtime/samples/wasi-threads
Marcin Kolny 879563047f
Fix thread termination example (#1915)
The example wasn't fully implemented the intention - it didn't work as
expected when the trap/proc_exit was executed on the main thread,
because main thread never waited for all the threads to start.
2023-01-25 09:34:36 +08:00
..
wasm-apps Fix thread termination example (#1915) 2023-01-25 09:34:36 +08:00
CMakeLists.txt Create a placeholder for WASI threads implementation (#1783) 2022-12-06 21:11:27 +08:00
README.md feat(wasi-threads): Add example of exception propagation (#1812) 2022-12-16 14:22:53 +08:00

"WASI threads" sample introduction

Currently, since the wasi-sdk does not have thread support in the latest release, make sure to have wasi-libc installed. Build it with threads enabled, e.g.

make \
    AR=/opt/wasi-sdk/bin/llvm-ar \
    NM=/opt/wasi-sdk/bin/llvm-nm \
    CC=/opt/wasi-sdk/bin/clang \
    THREAD_MODEL=posix

Build and run the samples

$ mkdir build
$ cd build
$ cmake -DWASI_SYSROOT=/path/to/wasi-libc/sysroot ..
$ make
...
$ ./iwasm wasm-apps/no_pthread.wasm
...
$ ./iwasm wasm-apps/exception_propagation.wasm