On Tue, Nov 13, 2007 at 06:15:00PM -0800, Christopher Layne wrote:
> 1. Make EV_PERSIST reschedule timeouts automatically.
> 2. New function: timeout_schedule: (nothing really new within it, just
>    modular wrapping of timeout rescheduling).
> 3. New macro: evutil_timercpy: tv_dst = tv_src in one line type deal;
> 3. Regression tests for persistent timeouts, include read/write, signals,
>    and timers.
> 4. Another regression test for signal handler restores (no problem, just
>    added another one).
> 
> So what this means is that if you do the following:
> 
>       event_set(ev, fd, EV_READ | EV_PERSIST, read_cb, obj);
>       event_add(ev, &timeout);
> 
> read_cb() will be called whenever a read event happens, and it's timeout
> as passed to event_add() will be reset to the original value you passed.
> You do not have to call event_add() within the handler.
> 
>       event_set(ev, -1, EV_TIMEOUT | EV_PERSIST, timer_cb, obj);
>       event_add(ev, &cycle);
> 
> timer_cb() will be called when timeout (as passed via cycle) expires. It
> will then reschedule itself with it's original timeout, e.g. periodic timer.
> You do not have to call event_add() within the handler.

What was the original behavior? Did the timer disappear? If not, I fail to
see how the new behavior is more justificed than the old; meaning, instead
of changing it, why not add it as an option? If waiting to read an entire
line, but you are trickled one byte at a time, do you really want to reset
the timeout between bytes, or is the timeout meant to limit the time spent
on reading the line?

> For the event_del() changes, it's just moving event_del() into event_active(),
> when an event occurs. There is a feature request on sourceforge for this,
> and this couples nicely with the EV_PERSIST change. It also allows us to
> rexamine the logic tests within the various event dispatchers themselves, as
> event_active() will only delete the same event once.

Will this cause incompatabilities? What if you call event_add() anyhow? Will
it return failure? This could silently break code. Maybe the user set
EV_PERSIST, realized it didn't do what he wanted, but never removed it.

_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkeymail.org/mailman/listinfo/libevent-users

Reply via email to