pthread_rwlockattr_getpshared(), pthread_rwlockattr_setpshared()

get and set the process-shared attribute of the read-write lock attributes object 

Advanced Realtime Threads


SYNOPSIS

#include <pthread.h>

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

int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *attr, int pshared);


DESCRIPTION

The pthread_rwlockattr_getpshared() function gets the value of the process-shared attribute from the initialized attributes object pointed to by the attr argument. The pthread_rwlockattr_setpshared() function sets the process-shared attribute in an initialized attributes object pointed to by attr.

The process-shared attribute is set to PTHREAD_PROCESS_SHARED to allow any thread with access to the memory where the read-write lock is allocated to operate on the read-write lock, even if multiple processes share that memory. If the process-shared attribute is PTHREAD_PROCESS_PRIVATE, only threads created within the same process as the process that initialized the read-write lock may operate the read-write lock. The process-shared attribute has a default value of PTHREAD_PROCESS_PRIVATE.


PARAMETERS

attr 

Points to a read-write lock attributes object.

pshared 

Stores the value of the process-shared attribute.


RETURN VALUES

On success, the pthread_rwlockattr_getpshared() function returns zero and stores the value of the process-shared attribute of attr in the object pointed to by the pshared argument. On success, the pthread_rwlockattr_setpshared() function returns zero. On failure, both functions return one of the following error numbers:

EINVAL 

The attr argument points to an invalid value or the new value specified for the attribute is outside the range of legal values for that attribute.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

The PTHREAD_PROCESS_SHARED process-shared state is not currently supported; if this value is specified, the function returns ENOTSUP.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
pthread_rwlock_destroy(), pthread_rwlockattr_destroy(), pthread_rwlockattr_init()


PTC MKS Toolkit 10.3 Documentation Build 39.