Multithreaded Programming Guide

Getting the Clock Selection Condition Variable

Use the pthread_condattr_getclock(3C) function to obtain the value of the clock attribute from the attributes object referenced by attr. The clock attribute is the clock ID of the clock that is used to measure the timeout service of pthread_cond_timedwait().

pthread_condattr_getclock Syntax

int pthread_condattr_getclock(const pthread_condattr_t *restrict attr,
          clockid_t *restrict clock_id);
#include <pthread.h>

pthread_condattr_t attr
clockid_t clock_id
int ret

ret = pthread_condattr_getclock(&attr &clock_id

pthread_condattr_getclock Returns

pthread_condattr_getclock() returns zero after completing successfully and stores the value of the clock attribute of attr into the object referenced by the clock_id argument. Any other return value indicates that an error occurred. When the following condition occurs, the function fails and returns the corresponding value.



The value of attr is invalid.