rmutex_init(3synch) rmutex_init(3synch)
NAME
rmutex_init - initialize a recursive mutex
SYNOPSIS
cc [options] -Kthread file
#include <synch.h>
int rmutex_init(rmutex_t *rmutex, int type, void *arg);
Parameters
rmutex pointer to recursive mutex to be initialized
type USYNC_THREAD or USYNC_PROCESS
arg NULL (reserved for future use)
DESCRIPTION
rmutex_init initializes the recursive mutual exclusion lock
(rmutex) pointed to by rmutex to be of type type and in the
unlocked state. Once initialized, the rmutex can be used any
number of times without being re-initialized.
All operations on locks initialized with rmutex_init are
recursive.
rmutex Parameter
rmutex points to the rmutex to be initialized.
type Parameter
type can be set to one of the following values:
USYNC_THREAD Initialize the rmutex for threads within the
current process.
USYNC_PROCESS Initialize the rmutex for threads across
processes.
arg Parameter
arg should be set to NULL. It is not currently used, but is
reserved for future use.
Static Recursive Mutex Initialization
An rmutex can be initialized statically if its storage is
zero-filled. In this case, the rmutex is of type
USYNC_THREAD, and rmutex_init need not be called.
Copyright 1994 Novell, Inc. Page 1
rmutex_init(3synch) rmutex_init(3synch)
Return Values
rmutex_init returns zero for success and an error number for
failure, as described below.
Errors
If any of the following conditions is detected, rmutex_init
returns the corresponding value:
EINVAL Invalid argument specified.
REFERENCES
mutex(3synch), rmutex(3synch), rmutex_destroy(3synch),
rmutex_lock(3synch), rmutex_trylock(3synch),
rmutex_unlock(3synch), synch(3synch)
Copyright 1994 Novell, Inc. Page 2