Eric van Gyzen
2017-02-15 21:38:52 UTC
Would anyone else be interested in me adding a sem_timedwait3() function?
int sem_timedwait3(sem_t *sem, const struct timespec *abs_timeout,
clockid_t clock_id);
The clock_id would specify the reference clock for the absolute timeout.
The standard sem_timedwait() API uses CLOCK_REALTIME, which does not
play nicely with large clock adjustments.
I realize it would be non-standard. I also realize that there are
standard APIs that should probably be used instead, such as Pthread
condition variables with pthread_condattr_setclock(3). On the other
hand, the diff is [currently] tiny, so I thought I would offer it.
Cheers,
Eric
int sem_timedwait3(sem_t *sem, const struct timespec *abs_timeout,
clockid_t clock_id);
The clock_id would specify the reference clock for the absolute timeout.
The standard sem_timedwait() API uses CLOCK_REALTIME, which does not
play nicely with large clock adjustments.
I realize it would be non-standard. I also realize that there are
standard APIs that should probably be used instead, such as Pthread
condition variables with pthread_condattr_setclock(3). On the other
hand, the diff is [currently] tiny, so I thought I would offer it.
Cheers,
Eric