5 void *thr_fn1(void *arg
)
7 printf("thread 1 returning\n");
11 void *thr_fn2(void *arg
)
13 printf("thread 2 exiting\n");
14 pthread_exit((void *) 2);
23 err
= pthread_create(&tid1
, NULL
, thr_fn1
, NULL
);
25 fprintf(stderr
, "can't create thread 1: %s\n", strerror(err
));
29 err
= pthread_create(&tid2
, NULL
, thr_fn2
, NULL
);
31 fprintf(stderr
, "can't create thread 2: %s\n", strerror(err
));
35 err
= pthread_join(tid1
, &tret
);
37 fprintf(stderr
, "can't join with thread 1: %s\n",
41 printf("thread 1 exit code: %d\n", (int) tret
);
43 err
= pthread_join(tid2
, &tret
);
45 fprintf(stderr
, "can't join with thread 2: %s\n",
49 printf("thread 2 exit code: %d\n", (int) tret
);