rmutex_lock(3synch) rmutex_lock(3synch)
NAME
rmutex_lock - lock a recursive mutex
SYNOPSIS
cc [options] -Kthread file
#include <synch.h>
int rmutex_lock(rmutex_t *rmutex);
Parameters
rmutex pointer to recursive mutex to be locked
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).
From the point of view of the caller, rmutex_lock is atomic:
even if interrupted by a signal or forkall [see fork(2)],
rmutex_lock will not return until the lock is held.
Return Values
rmutex_lock returns zero for success and an error number for
failure, as described below.
Errors
If any of the following conditions is detected, rmutex_lock
fails and returns the corresponding value:
EINVAL Invalid argument specified.
USAGE
The locks acquired with rmutex_lock should be released with
rmutex_unlock.
Warnings
If a thread exits while holding an rmutex, the rmutex will not
be unlocked, and other threads waiting for the rmutex will
Copyright 1994 Novell, Inc. Page 1
rmutex_lock(3synch) rmutex_lock(3synch)
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(2), mutex(3synch), rmutex(3synch),
rmutex_destroy(3synch), rmutex_init(3synch),
rmutex_trylock(3synch), rmutex_unlock(3synch), synch(3synch)
Copyright 1994 Novell, Inc. Page 2