why these code in the second paragraph does not remove or return the semaphore?
Each time I have to remove them using ipcs system call from the prompt, but I want to remove them from the program. Thanks in advance.
Code:int a; if((a = semget(IPC_PRIVATE,1,0777|IPC_CREAT))==-1) { // get semaphore a perror("\nFailed to create semaphore."); exit(0); } if((semctl(a,0,IPC_RMID,0))==-1) { // Return semaphore a perror("\nCan't RPC_RMID."); exit(0); }