Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2003 16:17:19 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        John-Mark Gurney <gurney_j@efn.org>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: kern/45291: kevent(2) ignores timeout if nevents == 0
Message-ID:  <XFMail.20031013161719.jdp@polstra.com>
In-Reply-To: <20031013194716.GP533@funkthat.com>

index | next in thread | previous in thread | raw e-mail

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.

John


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20031013161719.jdp>