You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
printf()in Pthreads not works (test_pthread_printf.cpp failed) #11543
changed the title [-]`printf()`in Pthreads not works (test_pthread_printf.cpp not works)[/-][+]`printf()`in Pthreads not works (test_pthread_printf.cpp failed)[/+]on Jul 5, 2020
Activity
tigercosmos commentedon Jul 5, 2020
Seems the test, https://github.com/emscripten-core/emscripten/blob/master/tests/pthread/test_pthread_printf.cpp, do the same thing, but I can run it neither.
The test code: (remove
#include <emscripten>part)Run:
$ emcc test.c -s USE_PTHREADS=1 -s EXIT_RUNTIME=1 $ node --experimental-wasm-threads --experimental-wasm-bulk-memory a.out.js # nothing, it just hangs on ...[-]`printf()`in Pthreads not works[/-][+]`printf()`in Pthreads not works (test_pthread_printf.cpp not works)[/+][-]`printf()`in Pthreads not works (test_pthread_printf.cpp not works)[/-][+]`printf()`in Pthreads not works (test_pthread_printf.cpp failed)[/+]sbc100 commentedon Jul 5, 2020
This is known issue with emscripten pthread support: New pthreads can't be created until you return the event loop (return from main).
You can fix this in one of several ways:
-s PROXY_TO_PTHREAD-s PTHREAD_POOL_SIZE=Nwhere N > 0.emscripten_set_main_loopWe should really find a better way to report this issue as many people run into it.
tigercosmos commentedon Jul 6, 2020
@sbc100 No matter I use method 1 or method 2, it failed with:
method 1
method 2
sbc100 commentedon Jul 6, 2020
It looks like you are including your
test.ctwice on the command line.. which would lead to duplicate symbols.tigercosmos commentedon Jul 6, 2020
@sbc100 thanks! It works.
Shall I close this issue?
A piece of advice, IMO, it's better to update the tutorial. :)
sbc100 commentedon Jul 6, 2020
Yes, lets close this issue.
We do need to work on surfacing a fix for this common issue. I'll open a separate bug for that.