Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #include <pthread.h> | |
| 2 #include <stdio.h> | |
| 3 #include <unistd.h> | |
| 4 | |
| 5 void *thr0(void* arg) { | |
| 6 fopen("/tmp/z0", "w"); | |
| 7 return 0; | |
| 8 } | |
| 9 | |
| 10 void *thr1(void* arg) { | |
| 11 usleep(500000); | |
| 12 printf("success, %d\n", 1); | |
| 13 return 0; | |
| 14 } | |
| 15 | |
| 16 int main(int argc, char *argv[]) { | |
| 17 pthread_t t0, t1; | |
| 18 | |
| 19 pthread_create(&t0, NULL, thr0, NULL); | |
| 20 pthread_create(&t1, NULL, thr1, NULL); | |
| 21 | |
| 22 pthread_join(t0, NULL); | |
| 23 pthread_join(t1, NULL); | |
| 24 | |
| 25 return 0; | |
| 26 } | |
| OLD | NEW |