[Prev] [Contents] [Next]

pthread_rwlockattr_setpshared()--Set Pshared Read/Write Lock Attribute

Syntax

#include <pthread.h>
int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared);
Threadsafe: Yes
Signal Safe: Yes

The pthread_rwlockattr_setpshared() function sets the current pshared attribute for the read/write attributes object. The process shared attribute indicates whether the read/write lock that is created using the read/write lock attributes object can be shared between threads in separate processes (PTHREAD_PROCESS_SHARED), or only shared between threads in the same process (PTHREAD_PROCESS_PRIVATE).

Even if the read/write lock is in storage that is accessible from two separate processes, it cannot be used from both processes unless the process shared attribute is PTHREAD_PROCESS_SHARED.

Parameters

attr
(Input) Address of the variable containing the read/write lock attributes object
pshared
(Input) One of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.

Authorities and Locks

None.

Return Value

0
pthread_rwlockattr_setpshared() was successful.
value
pthread_rwlockattr_setpshared() was not successful. value is set to indicate the error condition.

Error Conditions

If pthread_rwlockattr_setpshared() was not successful, the error condition returned usually indicates one of the following errors. Under some conditions, the value returned could indicate an error other than those listed here.

[EINVAL]
The value specified for the argument is not correct.

Related Information

Example

See the pthread_rwlockattr_getpshared() example.


[Prev] [Contents] [Next]
Copyright © 1998, IBM Corporation. All rights reserved.
Comments? Contact
rchthrds@us.ibm.com