[Patch] C1X threading support

John Baldwin jhb at freebsd.org
Thu Dec 22 18:32:35 UTC 2011


On Thursday, December 22, 2011 12:04:14 pm Dag-Erling Smørgrav wrote:
> Hans Petter Selasky <hselasky at c2i.net> writes:
> > Absolute timeouts is no good idea! We should stick with kernel-ticks when 
> > possible :-)
> 
> There is no such thing as a kernel in the C standard.  All it knows
> about is the implementation and the program.  The best solution would
> probably have been a timescale that counts the time elapsed since the
> start of the program.

You could do relative timeouts specified in some absolute timescale like us or 
ns or ms.  You could even use a 'struct timespec' or some such to do that 
similar to how the it_interval member of struct itimer is used with 
setitimer(2).  That is what programmers actually want to use, and invariably 
end up implementing in a wrapper API around APIs that use absolute timeouts.

-- 
John Baldwin


More information about the freebsd-threads mailing list