Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int create_semaphor(union semun ctl, char letter){
- key_t key; //klucze semaforów
- int semid;
- if ((key = ftok(".", letter)) == -1)
- errx(1, "Blad tworzenia klucza!");
- if ((semid = semget(key, 1, IPC_CREAT | 0600)) == -1)
- errx(2, "Blad tworzenia semafora!");
- ctl.val = 1;
- if (semctl(semid, 0, SETVAL, ctl) == -1)
- errx(3, "Blad ustawiania semafora!");
- return semid;
- }
- semid0 = create_semaphor(ctl, 'a');
- semid1 = create_semaphor(ctl, 'b');
- semid2 = create_semaphor(ctl, 'g');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement