initialize a reader-writer lock
cc [options] -Kthread file
int rwlock_init(rwlock_t *rwlock, int type, void *arg);
rwlock_init initializes the reader-writer lock
pointed to by rwlock to be of type type
and in the unlocked state.
Once initialized, the lock can be used any number of
times without being re-initialized.
pointer to reader-writer lock to be initialized
USYNC_THREAD or USYNC_PROCESS
NULL (reserved for future use)
rwlock points to the reader-writer lock to be initialized.
type can be set to one of the following values:
initialize the reader-writer lock for threads within the current process
initialize the reader-writer lock for threads across processes
arg should be set to NULL.
It is not currently used, but is reserved for future use.
Static reader-Writer initialization
In this implementation,
a reader-writer lock can be initialized statically
if its storage is zero-filled.
In this case, the reader-writer lock is of type USYNC_THREAD,
and rwlock_init need not be called.
rwlock_init returns zero for success
and an error number for failure.
If the following condition is detected,
the contents of rwlock are not changed, and
rwlock_init returns the corresponding value:
Invalid type argument specified.
rwlock_init does not examine the rwlock argument
before initializing it.
If rwlock_init is called more than once for the same reader-writer lock,
it will overwrite its state.
It is the user's responsibility to ensure that rwlock_init
is only called once for each reader-writer lock.
Operations on locks initialized with
rwlock_init are not recursive--a thread can deadlock if
it attempts to reacquire a reader-writer lock that it already has acquired.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004