kern/45291: kevent(2) ignores timeout if nevents == 0
jdp at polstra.com
Mon Oct 13 16:17:28 PDT 2003
On 13-Oct-2003 John-Mark Gurney wrote:
> John Polstra wrote this message on Mon, Oct 13, 2003 at 09:37 -0700:
>> I disagree. The current behavior is not correct. It is inconsistent
>> with the longstanding behavior of both poll() and select(). Also,
>> from a practical standpoint, returning immediately instead of
>> waiting for the timeout to expire makes writing a typical event loop
>> more awkward. It requires the addition of a special case in the
>> application code to deal with the situation where no events are being
>> awaited. That's not necessary when using poll() or select().
> Simple fix, you wait for a single event, adding a struct kevent such as:
> struct kevent ke;
> ret = kevent(qfd, NULL, 0, &ke, 1, &ts);
> makes it wait the full 10 seconds. so, are you suggesting that we change
> the behavior to wait for the timeout to expire before we return ANY
> events? (because that is what your suggesting).
That's not what really what I was suggesting, but after thinking it
over some more I think I agree that it's OK as it stands. Because
you can use kevent() to register events, or wait for events, or both,
I guess it makes sense to ignore the timeout entirely when no events
could possibly be returned. Sorry for the noise.
More information about the freebsd-bugs