Level-triggering vs State-change triggering

Marc Lehmann schmorp at schmorp.de
Wed Nov 3 18:53:40 CET 2010


On Tue, Nov 02, 2010 at 02:51:42PM -0600, AJ ONeal <coolaj86 at gmail.com> wrote:
> I was expecting a state-change mechanism (is that edge-triggered?):

If you were expecting that, you'd need to worry about the start state and
a lot more, i.e. a state-change mechanism would probably never trigger in
your example.

> If the socket is changed not writable, but was most recently writable, the
> event would fire.

That's not really useful information in most cases.

> If the socket is changed writable, but was most recently not writable, the
> event would fire.

That would be somewhat useful.

> So the reasoning is that libev can tell at the moment that it checks what
> state it is currently, but not when the state changes?

It can do that, or rather, you cna do that using libev. For libev to do
that automatically it would need more feedback from the application than
it currently requests.

> It looks like epoll doesn't handle this case very gracefully from the
> snippet in the manpage that I read.

No, edge-triggered mechanisms are not at all graceful, and in practise,
always need a full check in some cases.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list