2022-12-16 06:22:53 +00: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 ](https://github.com/WebAssembly/wasi-libc ) installed. Build it with threads enabled, e.g.
```shell
make \
AR=/opt/wasi-sdk/bin/llvm-ar \
NM=/opt/wasi-sdk/bin/llvm-nm \
CC=/opt/wasi-sdk/bin/clang \
THREAD_MODEL=posix
```
2023-01-27 10:32:33 +00:00
## Build and run the samples
2022-12-16 06:22:53 +00:00
```shell
$ 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
```
2023-01-27 10:32:33 +00:00
## Run samples in AOT mode
```shell
$ ../../../wamr-compiler/build/wamrc \
2023-02-24 12:05:39 +00:00
--enable-multi-thread \
2023-01-27 10:32:33 +00:00
-o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
$ ./iwasm wasm-apps/no_pthread.aot
```