[Patch] C1X threading support

Warner Losh imp at bsdimp.com
Wed Dec 21 17:27:44 UTC 2011


On Dec 20, 2011, at 8:14 AM, Poul-Henning Kamp wrote:

> In message <4EF09FFD.7768.B66F73ED at s_sourceforge.nedprod.com>, "Niall Douglas" 
> writes:
> 
>>> And maybe, in trying to express that using a real-world example,
>>> the standards comittee would realize that UTC was a mistake, and
>>> changed the timeout argument to a relative time interval instead,
>>> like for instance the poll(2) system-call.
>> 
>> There was some very good argument against relative periods. I 
>> honestly can't remember what that was. It was a long time ago.
> 
> There are no good arguments against relative periods, in particular
> not when the crap they are replaced with requires you to put a
> loop around the sleep to get the desired behaviour in the first
> place.
> 
> The fact that you cant even remeber the argument doesn't in any way
> make it any more convincing.

When time changes in the system, as it is wont to do occasionally, then absolute time arguments will screw you.  There's no way to get them right that isn't a massively horrible kludge.  Let's say you want to sleep for no more than 1s.  You get the time, add 1s to it, get preempted, ntpd or somebody else notices the clocks are 1 year fast and adjusts, you get a quatum again and make the call with a timeout now 1-year in the future.

What could possibly outweigh that negative?

Warner



More information about the freebsd-threads mailing list