pthread_rwlockattr_gettype_np, pthread_rwlockattr_settype_np - get or set type attribute of read-write lock attributes object
#include <pthread.h> int pthread_rwlockattr_gettype_np(const pthread_rwlockattr_t *restrict attr, int *restrict type);
int pthread_rwlockattr_settype_np(pthread_rwlockattr_t *attr, int type);
The pthread_rwlockattr_gettype_np() and pthread_rwlockattr_settype_np() functions respectively get and set the type attribute of read-write lock attributes object. This attribute is set in the type parameter to these functions.
The type of read-write lock is contained in the type attribute of the read-write lock attributes. It augments the process-shared attribute of the read-write lock and can be set to bitwise-inclusive-OR of one or more of the following flags:
This is a regular rwlock type that can be used to synchronize threads in the same or different processes.
This type of read-write lock is NUMA-aware and scales well on large systems. A read-write lock of this type can only synchronize threads in the same process, thus it is compatible only with process-shared read-write lock attribute PTHREAD_PROCESS_PRIVATE. A read-write lock of this type cannot be initialized statically. A read-write lock of this type is read-reentrant, that is, if a thread has already acquired it as a reader it can acquire it as a reader more times even if a writer is waiting; it must be released the same number of times as it was acquired. Attempts to initialize a read-write lock with this type attribute may fail if insufficient memory exists to initialize it.
Upon successful completion, the pthread_rwlockattr_gettype_np() function returns 0 and stores the value of the type attribute of attr in the object referenced by the type parameter. Otherwise, an error number is returned to indicate the error.
Upon successful completion, the pthread_rwlockattr_settype_np() function returns 0. Otherwise, an error number is returned to indicate the error.
The pthread_rwlockattr_gettype_np() and pthread_rwlockattr_settype_np() functions may fail if:
The value specified by attr or type is invalid.
See attributes(7) for descriptions of the following attributes: