X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=sources%2FMutex.c;h=076c59360c430c4efe973064b8ce7e45765cddfe;hp=d0099982305d5d42c0b1c36ac3baead2afac66f1;hb=b8248eaf35d824e8816c76ad9f9561c76d67b915;hpb=e18f3ea57b725bc148f0d3443e384bf5270b2b9f diff --git a/sources/Mutex.c b/sources/Mutex.c index d009998..076c593 100644 --- a/sources/Mutex.c +++ b/sources/Mutex.c @@ -22,7 +22,7 @@ * * Author: S. Piccardi Dec. 2002 * - * $Id: Mutex.c,v 1.3 2002/12/05 23:38:22 piccardi Exp $ + * $Id: Mutex.c,v 1.4 2003/01/04 17:24:30 piccardi Exp $ * *****************************************************************************/ #include /* IPC semaphore declarations */ @@ -65,7 +65,7 @@ int MutexCreate(key_t ipc_key) */ int MutexFind(key_t ipc_key) { - return semget(ipc_key,1,0); + return semget(ipc_key, 1, 0); } /* * Function MutexRead: read the current value of the mutex/semaphore @@ -109,6 +109,16 @@ int MutexUnlock(int sem_id) { return semop(sem_id, &sem_ulock, 1); } +/* + * Function MutexRemove: remove a mutex/semaphore + * + * Input: a semaphore id # + * Return: return code of semctl + */ +int MutexRemove(int sem_id) +{ + return semctl(sem_id, 0, IPC_RMID); +} /***************************************************************************** * * File locking mutex