Thanks jj for the advice.

Brian Gavin
On Thursday, May 13, 2021 at 10:15:54 AM UTC-4 jj wrote:

> You will either need to use OFFSCREENCANVAS_SUPPORT (preferred), or
> OFFSCREEN_FRAMEBUFFER, which is a fallback mode that can be used that
> does not require OffscreenCanvas support. Both can be used at the same
> time, which enables targeting OffscreenCanvas when available, and
> falling back to the emulated offscreen framebuffer mode when not
> available.
>
> For EM_ASM(), you need to analyze each and decide whether you want to
> call those EM_ASM()s in the calling thread, or on the main thread. If
> on the calling thread, then keep using EM_ASM().
>
> If the block should be executed on the main thread, then you have two
> choices: either execute it synchronously with MAIN_THREAD_EM_ASM(), or
> with MAIN_THREAD_EM_ASM_INT() or MAIN_THREAD_EM_ASM_DOUBLE() if you
> need a return value back. This can be slow and cause a perf impact. If
> you do not need a synchronous result back, and you have taken care of
> thread synchronization via other means (or synchronization does not
> particularly matter), you can instead execute with
> MAIN_THREAD_ASYNC_EM_ASM(), which will asynchronously queue the call
> to the main thread, letting the calling thread immediately proceed
> with resuming code execution.
>
> I have not looked at Embind in a while to know if there are issues
> there. Most likely all the function calls are done in the calling
> thread, so if you need to route calls to main thread, you'll need to
> implement that yourself.
>
> To get the JS Worker object, get the pthread pointer (e.g. via
> pthread_self()), then loop through the global JS variable
> "PThread.runningWorkers", and find the worker object with a matching
> "worker.pthread" value. The worker that matches will be the Web Worker
> object corresponding to that pthread.
>
> to 13. toukok. 2021 klo 15.31 Brian Gavin ([email protected]) kirjoitti:
> >
> > Hi,
> > I am looking at using PROXY_TO_PTHREAD to thread. I was hoping for some 
> advice using it. I use webgl so it looks like I need to use -s 
> OFFSCREENCANVAS_SUPPORT=1?
> >
> > How should I convert EM_ASM(...) code? How I use Emind functions? Is 
> there a way to find the webworker that holds the wasm thread?
> >
> > Thanks
> > Brian Gavin
> >
> > --
> > 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/84808318-f304-4d98-993a-7571072ce134n%40googlegroups.com
> .
>

-- 
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/a5262d50-c54b-4117-aedb-74f334d52c27n%40googlegroups.com.

Reply via email to