Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / System programming / Practice11 / ex1.c
blob: 4086ca7004512d838191fa795beac40200e1a4e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() {
	sem_t* sem = sem_open("/sem", O_CREAT);

	int sval = 0;
	sem_getvalue(sem, &sval);
	printf("%d\n", sval);

	sem_close(sem);
	sem_unlink("/sem");

	return 0;
}