Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <sys/types.h>
  3. #include <sys/ipc.h>
  4. #include <sys/sem.h>
  5. #include <stdlib.h>
  6. #include <unistd.h>
  7.  
  8. #define PERMS 0666
  9.  
  10.  
  11. int main()
  12. {
  13. int semid = -1; // identyfikator semafora
  14.  
  15. if ((semid = semget(ftok("/tmp",0), 1, IPC_CREAT | PERMS)) <0)
  16. perror("blad tworzenia semafora");
  17.  
  18. if(semctl(semid, 0, IPC_RMID,0)<0){
  19. perror("blad usuwania semafora");
  20. }
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement