cosmos72 / gls

Fast goroutine local storage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WASM Support

pilat opened this issue · comments

Greetings,

I'm using your gls package and encountered an issue when building an app for the WASM platform.

Upon reviewing your gomacro project, I observed the WASM stub. It appears the stub was created under the assumption that goroutines don't operate on WASM due to its lack of thread support. However, as mentioned in this StackOverflow post while WASM doesn't support threads, goroutines are fully functional there.

To address this, I crafted an id_wasm.s file, adopting content from id_arm64.s, which resolved the matter. Later, I identified a similar solution here.

I've assembled a demonstration through a simple WASM application, showcasing gls operating efficiently with WASM. The example is available at https://github.com/pilat/gls-wasm-test.

If it's of interest to you, I'm willing to open a PR here to integrate these changes, facilitating better support for the WASM platform.

That's definitely a welcome addition, thanks!
It will also help to add support for GOOS=js GOARCH=wasm target to gomacro, which uses a private copy of this package.

Waiting for your pull request :)

Just wanted to say thank you for merging the PR for WASM support. It's working great for my needs, and I really appreciate your quick action on this!