CVSROOT:        /cvs
Module name:    src
Changes by:     chel...@cvs.openbsd.org 2020/03/19 22:49:17

Modified files:
        sys/kern       : kern_synch.c 

Log message:
__thrsleep(2): fix absolute timeout check

An absolute timeout T elapses when the clock has reached time T, i.e.
when T is less than or equal to the clock's current time.

But the current code thinks T elapses only when the clock is strictly
greater than T.

For example, if my absolute timeout is 1.00000000, the current code will
not return EWOULDBLOCK until the clock reaches 1.00000001.  This is wrong:
my absolute timeout elapses a nanosecond prior to that point.

So the timespeccmp(3) here should be

timespeccmp(tsp, &now, <=)

and not

timespeccmp(tsp, &now, <)

as it is currently.

Reply via email to