tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kqueue



On Tuesday 19 January 2010 18:54:17 Jaromir Dolecek wrote:
> The manpage is right without EV_CLEAR.  One must use EV_CLEAR to
> get the behaviour described by the guy in the Caveats section.
> 
> I've tested this on Mac OS X and NetBSD with attached program.
> If I don't use EV_CLEAR, the second kevent() returns immediatelly.
> Second kevent() blocks if the code is modified to set EV_CLEAR flag.
> 
> Jaromir
> 

Yeah that's right. I discovered that too while testing kqueue. Without 
EV_CLEAR, kevent acts as level-triggered (it always returns as long as a 
condition holds, socket readable/writeable etc). Setting EV_CLEAR causes 
kevent to act as edge-triggered (it returns once when state changes and will 
block on second call until state changes again).

So what's the advantage of one over the other?


Home | Main Index | Thread Index | Old Index