emscripten-core / emscripten-core/emscripten

Main thread hangs even with PTHREAD_POOL_SIZE

Open
#14,097 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I have set PTHREAD_POOL_SIZE to 5 and everything runs but

```
void test() {
std::future request = std::async(std::launch::async, [] {
emscripten_sleep(100);

return 4;
});

std::cout << request.get() << std::endl;
}
```

After invoking this test function from JS for more than 5 times, the main thread basically hangs.

What's more interesting is that I see following warning in the console,

`Blocking on the main thread is very dangerous, see https://emscripten.org/docs/porting/pthreads.html#blocking-on-the-main-browser-thread`

Is this expected?

I have not used the Proxy flag because I thought that it's overkill!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.