sem_timedwait3(..., ..., clockid_t)

Eric van Gyzen vangyzen at FreeBSD.org
Wed Feb 15 21:57:38 UTC 2017


On 02/15/2017 15:38, Eric van Gyzen wrote:
> 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.

kib@ suggested that I use the _np suffix, which is an obviously good 
idea, so the proposal is now:

int sem_timedwait3_np(sem_t *sem, const struct timespec *abs_timeout,
     clockid_t clock_id);

Eric


More information about the freebsd-arch mailing list