Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for threadlocal variables for Wasm #15935

Closed
Aandreba opened this issue Jun 2, 2023 · 2 comments
Closed

Adding support for threadlocal variables for Wasm #15935

Aandreba opened this issue Jun 2, 2023 · 2 comments
Labels
arch-wasm 32-bit and 64-bit WebAssembly

Comments

@Aandreba
Copy link

Aandreba commented Jun 2, 2023

Reasons

With the increased usage of Workers to add multi-threading capabilities to WebAssembly programs, I find myself missing thread local variables on zig Wasm.
Since Wasm is always assumed to be single-threaded, threadlocal variables are always treated as container-level variables.

Possible solutions

  • Allow manually disabling the single_threaded build flag on Wasm targets (perhaps require shared_memory to be enabled).
  • Add some mechanism to create thread local variables, even in single_threaded mode.
@andrewrk andrewrk added the arch-wasm 32-bit and 64-bit WebAssembly label Jul 23, 2023
@andrewrk
Copy link
Member

andrewrk commented Jul 23, 2023

check out these latest developments:

I think there is nothing else to do here. Thread-local variables should work as you expect them to. If that is not the case, please provide some example code I'll re-open the issue.

@Aandreba
Copy link
Author

Awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-wasm 32-bit and 64-bit WebAssembly
Projects
None yet
Development

No branches or pull requests

2 participants