Hi, I have a question about using -s PROXY_TO_THREAD=1. My C code has 2 entry points:
int32_T main(int32_T argc,charPtr_T *argv){ //some initialisation #ifdef __EMSCRIPTEN__ emscripten_exit_with_live_runtime(); return 0; } EMSCRIPTEN_KEEPALIVE Error_T wasmEvent(int32_T evtType, int32_T nInt, float_T nFloat, void* param) { //handling of all events coming in from JS return 0; } Options used: -s ALLOW_MEMORY_GROWTH=1 ^ -s ENVIRONMENT=web,worker ^ --shell-file ./index_template.html ^ -s SUPPORT_ERRNO=0 ^ -s MODULARIZE=1 ^ -sWASM_WORKERS ^ -pthread ^ -s PTHREAD_POOL_SIZE=1 ^ -s PROXY_TO_PTHREAD=1 ^ -s "EXPORT_NAME='wasmMod'" ^ -s EXPORTED_FUNCTIONS="['_malloc','_free','_main']" ^ -s EXPORTED_RUNTIME_METHODS= "['cwrap','UTF16ToString','UTF8ToString','stringToUTF8','allocateUTF8']" ^ -o index.html When main is called emscripten_is_main_runtime_thread() and emscripten_is_main_browser_thread() both return 0 as expected. However, if I call wasmEvent from JS (using cwrap), they both return 1, so the code is not running in the same thread as main but rather in the main browser thread? I can remember the first thread like this mainThread = pthread_self(); and then use emscripten_dispatch_to_thread(mainThread, EM_FUNC_SIG_VI, _wasmEvent, 0,(void*)&e, 0); That does work, but I am unsure about the described behavior. I expected all code to run in the thread that ran main, except for specified pthreads created later. What am I doing wrong? Dieter -- 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 emscripten-discuss+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/08f40bd0-3147-4a3c-a184-4aa40bde4987n%40googlegroups.com.