15 lines
303 B
C
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;
|
|
}
|