Debian Codegraph @

test cases/wasm/2 threads/threads.c

raw
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <pthread.h>
4
5 void inthread(void * args) {
6 sleep(1);
7 printf("In thread\n");
8 }
9
10 int main() {
11 #ifdef __EMSCRIPTEN_PTHREADS__
12 pthread_t thread_id;
13 printf("Before Thread\n");
14 pthread_create(&thread_id, NULL, (void *)*inthread, NULL);
15 pthread_join(thread_id, NULL);
16 printf("After Thread\n");
17 return 0;
18 #else
19 # error "threads not enabled\n"
20 #endif
21 }