Hi there,

I wonder what is the best way to pass a byte array from non-main-thread
C++ to main-thread JS. I'm hesitating to call MAIN_THREAD_SYNC_EM_ASM
because I don't want to block the C++ thread. So the next two options
are EM_ASM and MAIN_THREAD_ASYNC_EM_ASM. In the asynchronous case,
obviously I would have to malloc in C++ and free in JS. Is that
possible? In the EM_ASM case, JS doesn't have access to any regular
objects from the main JS environment. So I would have to copy the data
and defer to the main JS thread? I suppose there is one worker.js that I
would have to listen to from main, and use postMessage from within EM_ASM?

Also the data is bounded by 8K, could I perhaps use a different
approach, like use a constant size array direct passing somehow?

best, .h.h.

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/52f2a4ac-2baa-8d90-1486-c5adc57873f4%40sciss.de.

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to