Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/permutationlock/zig_emscripten_threads
A toy example showing Zig threads working in Emscripten
https://github.com/permutationlock/zig_emscripten_threads
emscripten threads zig
Last synced: 2 days ago
JSON representation
A toy example showing Zig threads working in Emscripten
- Host: GitHub
- URL: https://github.com/permutationlock/zig_emscripten_threads
- Owner: permutationlock
- Created: 2023-09-20T13:59:14.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-13T22:02:23.000Z (8 months ago)
- Last Synced: 2024-03-14T23:00:20.239Z (8 months ago)
- Topics: emscripten, threads, zig
- Language: Zig
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Zig threads in Emscripten
A toy example showing Zig threads working in the browser with Emscripten.
Currently requires the standard library patch [#19287](https://github.com/ziglang/zig/pull/19287). Also, there are issues with allocators in Emscripten release builds when not using
the `emcc` flag `-s USE_OFFSET_CONVERTER`, see [here](https://ziggit.dev/t/state-of-concurrency-support-on-wasm32-freestanding/1465/9?u=permutationlock).A go webserver is provided to host the Emscripten app with cross-origin
isolation turned on. Threading in Emscripten uses the experimental shared memory
browser features which can only run in pages with cross-origin isolation.To build and host the application:
```Shell
zig build --sysroot [emsdk]/upstream/emscripten
go run server.go
```Then go to [http://127.0.0.1:8083](http://127.0.0.1:8083) in a browser to
hopefully see the printout and no console errors.