JS atomics compatible with Emscripten/C++ atomics? #18850
-
Are JS atomics, specifically MDN Atomics, interoperable with the various atomics libraries in Emscripten? More specifically, if I use an atomic_int in a C++ object, and I do some sort of C++ wait in a thread, can I notify on that atomic_int from JS with Atomic.notify() (using a HEAP offset into my C++ object)? I'm a little new to Atomics here, so not sure. Also not sure of which C++ wait call I could use. Are they all intercompatible with each other? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, you can mix C++ and JS atomics, they should have the same semantics. Of course, using bare atomics can painful and risky so you can also just call the native helper functions functions such as |
Beta Was this translation helpful? Give feedback.
Yes, you can mix C++ and JS atomics, they should have the same semantics.
Of course, using bare atomics can painful and risky so you can also just call the native helper functions functions such as
emscripten_futex_wait
andemscripten_futex_wake
from JS if you want to interoperate with them.