srv_unlockmutex

Description

Unlock a mutex.

Syntax

CS_RETCODE srv_unlockmutex(mutexid)
SRV_OBJID              mutexid;

Parameters

mutexid

The unique mutex identifier that was returned by srv_createmutex. mutexid can be obtained from the mutex name with srv_getobjid.

Returns

Table 3-148:  Return values (srv_unlockmutex)

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_unlockmutex PROTOTYPE((
CS_CHAR         *mutex_name
));

/* 
** EX_SRV_UNLOCKMUTEX
**
**    Example routine to illustrate the use of srv_unlockmutex.
**
** Arguments:
**  mutex_name   The name of the mutex to be unlocked.
**
** Returns:
**
**    CS_SUCCEED Mutex successfully unlocked.
**    CS_FAIL      An error was detected.
*/
CS_RETCODE     ex_srv_unlockmutex(mutex_name)
CS_CHAR        *mutex_name;
{
     SRV_OBJID      id;
     CS_INT        info;

      /* Get the object id for the mutex. */
      if (srv_getobjid(SRV_C_MUTEX, mutex_name, CS_NULLTERM, 
            &id,  &info) == CS_FAIL)
           return (CS_FAIL);

     /* Call srv_unlockmutex to unlock it. */
    if (srv_unlockmutex(id) == CS_FAIL)
      return (CS_FAIL);

      return (CS_SUCCEED);
}

Usage

See also

srv_createmutex, srv_deletemutex, srv_getobjid