pthread_condattr_getpshared() — Get the process-shared condition variable attribute

Standards

Standards / Extensions C or C++ Dependencies

Language Environment Extension
Single UNIX Specification, Version 3

both z/OS® V1R2

Format

#define _OPEN_THREADS
#define _OPEN_SYS_MUTEX_EXT
#include <pthread.h>

int  pthread_condattr_getpshared(const pthread_condattr_t *attr,
                                 int *pshared);
SUSV3:
#define _UNIX03_THREADS 
#include <pthread.h>
int pthread_condattr_getpshared(const pthread_condattr_t * __restrict__attr,
                                int * __restrict__pshared);

General description

Gets the attribute pshared for the condition variable attribute object attr. By using attr, you can determine its process-shared value for a condition variable.

Valid values for the attribute pshared are:
Value
Description
PTHREAD_PROCESS_SHARED
Permits a condition variable to be operated upon by any thread that has access to the memory where the condition variable is allocated; even if the condition variable is allocated in memory that is shared by multiple processes.
PTHREAD_PROCESS_PRIVATE
A condition variable can only be operated upon by threads created within the same process as the thread that initialized the condition variable. If threads of differing processes attempt to operate on such a condition variable, only the process to initialize the condition variable will succeed. When a new process is created by the parent process it will receive a different copy of the private condition variable which can only be used to serialize between threads in the child process.
Note: This is the default value of pshared

Returned value

If successful, 0 is returned. If unsuccessful, -1 is returned and the errno value is set. The following is the value of errno:
Value
Description
EINVAL
The value specified for attr is not valid.

Special behavior for Single UNIX Specification, Version 3: If unsuccessful, pthread_condattr_getpshared() returns an error number to indicate the error.

Related information