rwlock_init(3scl)rwlock_init(3scl)NAMErwlock_init - Initializes a readers/writer lock.
LIBRARY
SCL Threads Library (libthread.so)
SYNOPSIS
#include <synch.h>
int rwlock_init(
rwlock_t *rwlockp,
int type,
void *arg );
PARAMETERS
Address of the readers/writer lock to be initialized. Integer value
indicating the type of readers/writer lock required. Possible values
are: for synchronization between threads within a single process
(process-wide scope) for synchronization between threads in different
processes (system-wide scope). Not supported in this release of the
Solaris Compatibility Libraries. Unused. Typically NULL.
DESCRIPTION
This routine initializes a readers/writer lock. A readers/writer lock
is a synchronization object that allows multiple threads to lock it
concurrently for read access, or for one thread to exclusively write-
lock it.
SCL IMPLEMENTATION NOTESrwlock_init(3scl) is implemented by calling tis_rwlock_init(3).
rwlock_init(3scl) first checks the type parameter. In this implementa‐
tion of the Solaris Compatibility Libraries for Tru64 UNIX, system-wide
(USYNC_PROCESS) readers/writer locks are not supported. When an attempt
to initialize a readers/writer lock to type USYNC_PROCESS is made, the
action taken by this routine is controlled by the environment variable
STL_USYNC_PROCESS_ACTION. The possible values for
STL_USYNC_PROCESS_ACTION, and their meanings, are: log an error message
and abort the process (this is the default action) logs a
"USYNC_PROCESS readers/writer lock unsupported" error message and
returns EINVAL initializes readers/writer lock as type USYNC_THREAD
Tests on Solaris indicate that calling rwlock_init() with an already
initialized (and even locked) readers/writer lock cause the lock to be
re-initialized, and a status of 0 is returned. The tis_rwlock_init(3)
routine seems to return an undocumented EBUSY status in such circum‐
stances, which this routine maps to EFAULT and logs a message to the
SCL errorlog.
RETURN VALUES
If an error condition occurs, this routine returns an integer value
indicating the type of error.
Additional error return information may be written to the SCL error
log. Refer to scl_error_log(4scl) for details.
Possible return values are as follows: Successful completion. The
value specified by the type parameter is invalid for this SCL implemen‐
tation. Or:
Error EINVAL from tis_rwlock_init(3). An internal implementation error
occurred. Refer to the SCL errorlog for additional information. (This
includes tis_rwlock_init(3) returning the undocumented status EBUSY).
Note: EFAULT is not returned if rwlockp is an illegal address. An ille‐
gal address generates a SIGSEGV signal, which by default will abort the
process and generate a core dump.
ERRORS
None.
RELATED INFORMATION
Functions: rw_rdlock(3scl), rw_tryrdlock(3scl), rw_trywrlock(3scl),
rw_unlock(3scl), rw_wrlock(3scl), rwlock_destroy(3scl),
scl_intro(3scl), scl_thread_intro(3scl), tis_rwlock_init(3)
Files: scl_error_log(4scl)
Manuals: Solaris Compatibility Libraries User's Guide
rwlock_init(3scl)