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