pthread_rwlockattr_setpshared(3pthread)


pthread_rwlockattr_setpshared, pthread_rwlockattr_getpshared -- set, get, process-shared attribute of read-write lock

attributes object

Synopsis

   cc [options] -Kthread file
   

#include <pthread.h>

int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared); int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *attr, int *pshared);

Description

pthread_rwlockattr_setpshared sets the process-shared attribute in an initialized attributes object pointed to by attr.

pthread_rwlockattr_getpshared obtains the value of the process-shared attribute from the initialized attributes object pointed to by attr.

The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a read-write lock to be operated upon by any thread that has access to the memory where the read-write lock is allocated, even if the read-write lock is allocated in memory that is shared by multiple processes. If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, the read-write lock will only be operated upon by threads created within the same process as the thread that initialized the read-write lock; if threads of differing processes attempt to operate on such a read-write lock, the behavior is undefined. The default value of the process-shared attribute is PTHREAD_PROCESS_PRIVATE.

Return values

pthread_rwlockattr_getpshared returns zero on success, and stores the value of the process-shared attribute of attr into the object pointed to by the pshared parameter. Otherwise an error number is returned.

pthread_rwlockattr_setpshared function returns zero on success. Otherwise, an error number is returned.

Diagnostics

pthread_rwlockattr_getpshared and pthread_rwlockattr_setpshared return the following values if the corresponding conditions are detected:

EINVAL
The value specified by attr is invalid.

pthread_rwlockattr_setpshared returns the following value if the corresponding condition is detected:


EINVAL
The new value specified for the attribute is outside the range of legal values for that attribute.

Standards compliance

The Single UNIX Specification, Version 2; The Open Group.

References

Intro(3pthread), pthread(4), pthread_rwlockattr_init(3pthread), pthread_rwlock_init(3pthread), pthread_rwlock_unlock(3pthread), pthread_rwlock_wrlock(3pthread), pthread_rwlock_rdlock(3pthread)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004