Skip to content

Support wasm32-wasi-threads#34

Merged
toyobayashi merged 62 commits intomainfrom
feat-wasi-threads
Mar 9, 2023
Merged

Support wasm32-wasi-threads#34
toyobayashi merged 62 commits intomainfrom
feat-wasi-threads

Conversation

@toyobayashi
Copy link
Owner

build with wasi-sdk-20.0+threads, missing multithreaded libc++.a so node-addon-api is unavailable in this pre-release version of wasi-sdk.

@toyobayashi
Copy link
Owner Author

@toyobayashi
Copy link
Owner Author

async work / tsfn may throw error in browser main thread due to pthread API use __builtin_wasm_memory_atomic_wait32 internally.

image

Approach:

  • User choose a Worker thread as emnapi main thread (like StackBlitz runs Node.js code in seperate Web Workers)
  • Emnapi provide another async work and tsfn implementation written in pure JavaScript (need further investigation)
  • Modify wasi-libc's futex_wait with busy wait in browser main thread (less feasible)

@toyobayashi toyobayashi marked this pull request as ready for review March 8, 2023 07:09
@toyobayashi toyobayashi merged commit 3e08959 into main Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant