rmutex_trylock(3synch) rmutex_trylock(3synch)
NAME
rmutex_trylock - conditionally lock a recursive mutex
SYNOPSIS
cc [options] -Kthread file
#include <synch.h>
int rmutex_trylock(rmutex_t *rmutex);
Parameters
rmutex pointer to recursive mutex to be locked
DESCRIPTION
rmutex_trylock attempts once to lock the recursive mutual
exclusion lock (rmutex) pointed to by rmutex.
If rmutex is available, rmutex_trylock will return
successfully with rmutex locked. If rmutex is already locked
by another thread, rmutex_trylock immediately returns EBUSY to
the caller without locking rmutex or blocking. If rmutex is
already held 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).
Return Values
rmutex_trylock returns zero for success and an error number
for failure, as described below.
Errors
If any of the following conditions is detected, rmutex_trylock
returns the corresponding value:
EBUSY rmutex is locked by another thread.
EINVAL Invalid argument specified.
USAGE
rmutex_trylock is used when the caller does not want to block.
The locks acquired with rmutex_trylock should be released with
rmutex_unlock.
Copyright 1994 Novell, Inc. Page 1
rmutex_trylock(3synch) rmutex_trylock(3synch)
REFERENCES
mutex(3synch), rmutex(3synch), rmutex_destroy(3synch),
rmutex_init(3synch), rmutex_lock(3synch),
rmutex_unlock(3synch), synch(3synch)
Copyright 1994 Novell, Inc. Page 2