Multithreaded Programming Guide


#include <pthread.h>

int pthread_rwlockattr_setpshared(pthread_rwlockattr_t  *attr, int  pshared);

pthread_rwlockattr_setpshared(3THR) sets the process-shared read-write lock attribute.


Permits a read-write lock to be operated on 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.


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 Value

If successful, pthread_rwlockattr_setpshared() returns zero. Otherwise, an error number is returned to indicate the error.


The value specified by attr or pshared is invalid.