12 static void *lecteur(void *arg
)
22 printf("lecteur bd=%d\n", db
);
23 // fin de l’accès à la base
33 static void *redacteur(void *arg
)
37 // modifier les données de la base
39 printf("redacteur bd=%d\n", db
);
49 sem_init(&mutex
, 0, 1);
50 sem_init(&redact
, 0, 1);
51 pthread_create(&t1
, NULL
, redacteur
, NULL
);
52 pthread_create(&t2
, NULL
, lecteur
, NULL
);
53 pthread_join(t1
, NULL
);
54 pthread_join(t2
, NULL
);