DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rmutex_init(SYNCH)


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(SYNCH), mutex(SYNCH), rmutex(SYNCH), rmutex_destroy(SYNCH), rmutex_lock(SYNCH), rmutex_trylock(SYNCH), rmutex_unlock(SYNCH)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005