6 pthread_t thread1, thread2;
8 static void * thread_doit1(void *forks_arg) {
16 static void * thread_doit2(void *forks_arg) {
24 int main(int argc, char* argv[]) {
25 sem_init(&sem1, 0, 1);
26 sem_init(&sem2, 0, 1);
28 pthread_create(&thread1, NULL, &thread_doit1, NULL);
29 pthread_create(&thread2, NULL, &thread_doit2, NULL);
31 pthread_join(thread1, NULL);
32 pthread_join(thread2, NULL);