*
* 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 <sys/sem.h> /* IPC semaphore declarations */
*/
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
{
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