rmutex_init(3synch)


rmutex_init -- initialize a recursive mutex

Synopsis

   cc [options] -Kthread file
   

#include <synch.h>

int rmutex_init(rmutex_t *rmutex, int type, void *arg);

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.

Parameters


rmutex
pointer to recursive mutex to be initialized

type
USYNC_THREAD or USYNC_PROCESS

arg
NULL (reserved for future use)

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.

Return values

rmutex_init returns zero for success and an error number for failure.

Errors

If the following condition is detected, rmutex_init returns the corresponding value:

EINVAL
invalid argument specified

References

Intro(3synch), mutex(3synch), rmutex(3synch), rmutex_destroy(3synch), rmutex_lock(3synch), rmutex_trylock(3synch), rmutex_unlock(3synch)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004