emscripten-core / emscripten-core/emscripten

pthread_create doesn't run

Open
#12,360 4 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

```
void *thr_fn(void *arg)
{
printf("this is a new thread\n");
int i;
while(1)
{
printf("%d\n", i);
emscripten_thread_sleep(200);
i++;
}
}

int EMSCRIPTEN_KEEPALIVE create_thread()
{
printf("this is create\n");
pthread_t ntid;
pthread_create(&ntid, NULL, thr_fn, NULL);
while(1)
{
emscripten_thread_sleep(200);
}
}
```
When I use the "create_thread" in a Web Worker, it seems to not run an not printf any number.

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.