Calling EMBind function from pthread Javascript

148 views
Skip to first unread message

Craig Matear

unread,
Mar 25, 2021, 10:51:34 AM3/25/21
to emscripten-discuss
Hi Guys, 

I'm having some trouble when trying to use Pthreads and emBind together. 

I have some C++ WASM code that is running on a worker thread (not the main thread). In the C++ I am doing:


        EM_ASM((    
            Module.test_Func();
        ));

Where test_Func is a EMBind function 

EMSCRIPTEN_BINDINGS(module) {
    emscripten::function("test_Func", &test_Func);
}

It seems that the Module object that's present on the worker thread doesn't have the definitions for the functions exported with EMBind. I'm wondering if this is a supported use case? 

If "Module.test_Func();" is run on the main thread then it works. 

I came across https://github.com/emscripten-core/emscripten/pull/8783 which looked like it was merged into the 2.0.15 release, which I updated to hoping that this would work, but no luck. 
 
Reply all
Reply to author
Forward
0 new messages