Multithreaded Programming Guide

Getting the Scope of a Condition Variable

pthread_condattr_getpshared(3C) gets the current value of pshared for the attribute object cattr.

pthread_condattr_getpshared Syntax

int pthread_condattr_getpshared(const pthread_condattr_t *restrict cattr,
          int *restrict pshared);
#include <pthread.h> 

pthread_condattr_t cattr; 
int pshared; 
int ret; 

/* get pshared value of condition variable */ 
ret = pthread_condattr_getpshared(&cattr, &pshared); 

The value of the attribute object is either PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE.

pthread_condattr_getpshared Return Values

pthread_condattr_getpshared() returns zero after completing successfully. Any other return value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.


EINVAL

Description:

The value of cattr is invalid.