mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-14 17:19:11 +00:00

Describe how to use WASI threads in AOT mode, following the discussion below: https://github.com/bytecodealliance/wasm-micro-runtime/pull/1867#discussion_r1070268062 Make aux stack boundary checks of wasi-threads always successful by setting `exec_env->aux_stack_bottom` to UINT32_MAX and `exec_env->aux_stack_boundary` to 0
32 lines
781 B
Markdown
32 lines
781 B
Markdown
# "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
|
|
```
|
|
|
|
## Build and run the samples
|
|
|
|
```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
|
|
```
|
|
|
|
## Run samples in AOT mode
|
|
```shell
|
|
$ ../../../wamr-compiler/build/wamrc \
|
|
-o wasm-apps/no_pthread.aot wasm-apps/no_pthread.wasm
|
|
$ ./iwasm wasm-apps/no_pthread.aot
|
|
```
|