rmutex_lock(SYNCH)
rmutex_lock --
lock a recursive mutex
Synopsis
cc [options] -Kthread file
#include <synch.h>
int rmutex_lock(rmutex_t *rmutex);
Description
rmutex_lock locks
the recursive mutual exclusion lock (rmutex)
pointed to by rmutex.
If rmutex is locked by another thread,
the calling thread is blocked until rmutex becomes available.
When rmutex_lock returns successfully,
the caller has locked rmutex.
If rmutex is already locked by the calling thread,
the recursive depth is incremented
and control is returned to the caller,
as if the lock had just been acquired.
rmutex must previously have been initialized
(see rmutex_init(SYNCH)).
Parameters
rmutex-
pointer to recursive mutex to be locked
From the point of view of the caller,
rmutex_lock is atomic:
even if interrupted by a signal or forkall [see
fork(S)],
rmutex_lock will not return
until the lock is held.
Usage
The locks acquired with rmutex_lock should be released
with rmutex_unlock.
Return values
rmutex_lock returns zero for success
and an error number for failure.
Errors
If the following condition is detected,
rmutex_lock fails and returns the corresponding value:
EINVAL-
invalid argument specified
Warnings
If a thread exits while holding an rmutex,
the rmutex will not be unlocked,
and other threads waiting for the rmutex will wait forever.
Similarly, if a process exits while holding a USYNC_PROCESS rmutex,
the rmutex will not be unlocked,
and other processes or threads waiting for the rmutex will wait forever.
References
fork(S),
Intro(SYNCH),
mutex(SYNCH),
rmutex(SYNCH),
rmutex_destroy(SYNCH),
rmutex_init(SYNCH),
rmutex_trylock(SYNCH),
rmutex_unlock(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005