Gets and sets the clock selection condition variable attribute.
int pthread_condattr_getclock(const pthread_condattr_t *restrict attr,
clockid_t *restrict clock_id);
int pthread_condattr_setclock(pthread_condattr_t *attr,
clockid_t clock_id);
The pthread_condattr_getclock subroutine obtains the value of the clock attribute from the attributes object referenced by the attr argument. The pthread_condattr_setclock subroutine sets the clock attribute in an initialized attributes object referenced by the attr argument. If pthread_condattr_setclock is called with a clock_id argument that refers to a CPU-time clock, the call will fail.
The clock attribute is the clock ID of the clock that shall be used to measure the timeout service of the pthread_cond_timedwait subroutine. The default value of the clock attribute refers to the system clock.
Item | Description |
---|---|
attr | Specifies the condition attributes object. |
clock_id | For pthread_condattr_getclock(), points
to where the clock attribute value will be stored.For pthread_condattr_setclock(),
specifies the clock to set. Valid values are:
|
If successful, the pthread_condattr_getclock subroutine returns 0 and stores the value of the clock attribute of attr in the object referenced by the clock_id argument. Otherwise, an error code is returned to indicate the error.
If successful, the pthread_condattr_setclock subroutine returns 0; otherwise, an error code is returned to indicate the error.
Item | Description |
---|---|
EINVAL | The value specified by attr is invalid. |
EINVAL | The pthread_condattr_setclock subroutine returns this error if the value specified by the clock_id does not refer to a known clock, or is a CPU-time clock. |
ENOTSUP | The function is not supported with checkpoint-restart processes. |