srv_deletemutex

Description

Delete a mutex created by srv_createmutex.

Syntax

CS_RETCODE srv_deletemutex(mutex_namep, mutex_namelen,
               mutex_id)
CS_CHAR        *mutex_namep;
CS_INT             mutex_namelen;
SRV_OBJID      mutex_id;

Parameters

mutex_namep

A pointer to the name associated with the mutex when it was created.

mutex_namelen

The length, in bytes, of the mutex_namep. If the string is null terminated, mutex_namelen can be set to CS_NULLTERM.

mutex_id

The unique identifier returned by srv_createmutex.

Returns

Table 3-33: Return values (srv_deletemutex)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#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);
}

Usage

See also

srv_createmutex, srv_getobjid, srv_getobjname, srv_lockmutex