a question for you WebAssembly experts out there.
What's the best memory strategy for sharing data among JS and proxied pthreads? I want to allocate a block of linear memory and share it globally in JavaScript and in proxied pThreads. Is it possible to do that right now in Chrome 92? How do I pass that memory to my WASM module? I created a block of memory in JS as:
let memory = new WebAssembly.Memory({initial:10, maximum:100, shared: true});
And allocate a Float32Array as such:
var pointer = new Float32Array(memory.buffer, offset, length);
I then populate the array with data as such:
pointer.set( data );
But when I pass hat pointer to my c++ function via EMBIND, the c++ code simply see them as array of 0. However, by allocating that memory on Module.Heap32, it did work. But then, it couldn't be shared among threads, since it is not built on SharedArrayBuffer. So what's a correct way to do this?
Appreciate any help.