Hello,
I'm using Emscripten with "-s USE_PTHREADS=1 -s PROXY_TO_PTHREAD=1 -s PROXY_POSIX_SOCKETS=1 -pthread -g4" compile/ link options to compile two different object files which are then linked together in the end with same options.
However, I'm finding that in object 2, if I use pthread_mutex_* APIs the second call fails with EINVAL, also sem_*() APIs too fail with same EINVAL. However, if I allocate ,initialize and return a pointer to pthread_mutex_t variable after initialization in object 1, it works perfectly fine. Lock/ unlock also works fine with pointer passing from object 2 -> 1. But still, the later pthread_cond_wait() calls fail again with EINVAL.
Am I missing any compiler/ linker flags here? I can reproduce the issue in both Win 10 & Ubuntu 20.04 Chrome as well as Linux Firefox.
Thanks,
Sarang.