[libdispatch-dev] testing tree now ported/automaked and committed
robert at fledge.watson.org
Thu Nov 5 02:24:11 PST 2009
On Thu, 5 Nov 2009, Paolo Bonzini wrote:
>> There are arguments for/against both approaches, but I was pondering adding
>> a non-portable POSIX semaphore extension to FreeBSD supporting relative
>> timeouts to avoid additional clock reads to convert between the two bases.
> Computing relative timeouts from absolute timeouts is problematic because
> you never know if the process can be scheduled between the computation of
> the delay and the actual invocation of the wait. Computing absolute timeouts
> from relative timeouts, instead, never has this problem.
> Since time-fetching syscalls usually have a fastpath on modern OSes, it
> would be nice if libdispatch provided a way to specify an absolute timeout.
The libdispatch API and time representation seem to get this fairly right --
dispatch_time_t is able to internally represent the difference between a
relative time and an absolute time.
Robert N M Watson
University of Cambridge
More information about the libdispatch-dev