[Libevent-users] Support for Edge-Triggered behaviour
Nick Mathewson
nickm at freehaven.net
Thu May 29 15:15:05 EDT 2008
On Thu, May 29, 2008 at 08:02:18PM +0200, Valery Kholodkov wrote:
>
> For the convenience I'll answer to Nick's questions from
> SF's patch tracker in this list.
>
> > A few initial questions:
> > - How exactly does the test_et.c file test the edge-triggered behavior?
> > As near as I can tell, the test ought to pass whether EV_ET works or not.
> > What am I missing?
>
> I hardly find a direct and automatic way to do it...
>
> Try following patch for test_et.c
[...]
>
> You should get following now:
>
> $ ./test_et
> read_cb: etread 1
> ^C *HANGING!!!*
> $ EVENT_NOKQUEUE=1 EVENT_NOEPOLL=1 ./test_et
> read_cb: read 1
> read_cb: read 1
Ah. In the edge-triggered case, the handler only gets called once,
but in the level-triggered case, the handler is called so long as
read() would still succeed.
[...]
> I must think a bit how to automate this. Please give me time.
Maybe you could use the EVLOOP_NONBLOCK flag to event_loop(), and call
it twice, and verify that in the edge-triggered case the event is only
activated on the first call, but in the level-triggered case the event
is activated on the second call too?
yours,
--
Nick
More information about the Libevent-users
mailing list