Delete a mutex created by srv_createmutex.
CS_RETCODE srv_deletemutex(mutex_namep, mutex_namelen,
mutex_id)
CS_CHAR *mutex_namep; CS_INT mutex_namelen; SRV_OBJID mutex_id;
A pointer to the name associated with the mutex when it was created.
The length, in bytes, of the mutex_namep. If the string is null terminated, mutex_namelen can be set to CS_NULLTERM.
The unique identifier returned by srv_createmutex.
Returns |
To indicate |
---|---|
CS_SUCCEED |
The routine completed successfully. |
CS_FAIL |
The routine failed. |
#include <ospublic.h>
/*
** Local Prototype.
*/
CS_RETCODE ex_srv_deletemutex PROTOTYPE((
CS_CHAR *mtxnm,
SRV_OBJID mtxid
));
/*
** EX_SRV_DELETEMUTEX
** Example routine using srv_deletemutex to delete an
** Open Server mutex previously created by srv_createmutex.
** This routine can be passed a mutex name, or NULL,
** in which case the mutex identifier will be used.
** Arguments:
** mtxnm Null terminated mutex name, or NULL to use mutex
** id.
** mtxid Mutex identifier (valid only if mtxnm is NULL).
** Returns:
** CS_SUCCEED mutex was successfully queued for deletion.
** CS_FAIL An error was detected.
*/
CS_RETCODE ex_srv_deletemutex(mtxnm, mtxid)
CS_CHAR *mtxnm;
SRV_OBJID mtxid;
{
/* Delete the mutex. */
if (srv_deletemutex(mtxnm, (CS_INT)CS_NULLTERM, mtxid) !=
CS_SUCCEED)
{
return(CS_FAIL);
}
return(CS_SUCCEED);
}
The mutex to delete can be referenced by its name or ID. If mutex_namep is not NULL, the name is used; otherwise, the ID is used.
A mutex is not deleted until other threads waiting to lock the mutex have had their requests satisfied and have released their locks.
An example of the use of mutexes appears on the srv_createmutex reference page.
srv_createmutex, srv_getobjid, srv_getobjname, srv_lockmutex