This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
TP-TR/chap2/snipets/semname.c
2022-05-12 11:54:16 +02:00

15 lines
303 B
C

#include <fcntl.h>
#include <semaphore.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
sem_t *count = sem_open("/application-semaphore", O_CREAT, 0600, 1);
sem_wait(count);
// Section c r i t i q u e
sem_post(count);
sem_unlink("/application-semaphore");
return EXIT_SUCCESS;
}