pthread_condattr_getpshared Subroutine
Purpose
Returns the value of the pshared attribute of a condition attributes object.
Library
Threads Library (libpthreads.a)
Syntax
#include <pthread.h>
int pthread_condattr_getpshared (attr, pshared)
const pthread_condattr_t *attr;
int *pshared;
Description
The pthread_condattr_getpshared subroutine returns the value of the pshared attribute of the condition attribute object attr. This attribute specifies the process sharing of the condition variable created with this attributes object. It may have one of the following values:
Item | Description |
---|---|
PTHREAD_PROCESS_SHARED | Specifies that the condition variable can be used by any thread that has access to the memory where it is allocated, even if these threads belong to different processes. |
PTHREAD_PROCESS_PRIVATE | Specifies that the condition variable shall only be used by threads within the same process as the thread that created it. This is the default value. |
Note: The pthread.h header file must be the first
included file of each source file using the threads library. Otherwise,
the -D_THREAD_SAFE compilation flag should be used, or the
cc_r compiler used. In this case, the flag is automatically set.
Parameters
Item | Description |
---|---|
attr | Specifies the condition attributes object. |
pshared | Points to where the pshared attribute value will be stored. |
Return Values
Upon successful completion, the value of the pshared attribute is returned via the pshared parameter, and 0 is returned. Otherwise, an error code is returned.
Error Codes
The pthread_condattr_getpshared subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
EINVAL | The attr parameter is not valid. |
ENOSYS | The process sharing POSIX option is not implemented. |