If you are using evtimer() to process IO events, you are not using
libevent correctly.  Honestly, I don't understand what problem you are
having and why this would be a good fix for it.

Maybe you want to make use of bufferevents.  They allow you to write
data to a buffer and libevent takes care of streaming it out to the
network.

Niels.

On 6/3/06, Arkadiusz Miskiewicz <[EMAIL PROTECTED]> wrote:
On Saturday 03 June 2006 17:48, Arkadiusz Miskiewicz wrote:

> It can be replaced only with
> evtimer_add(); // fire every 1 second to do the same as
> find_out_if_there_is_something in_internal_buffers_to_be_written_to_sockets
> () as in previous example; then event_add(EV_WRITE); fi
> event_add(EV_READ on listening sockets)
> event_dispatch()
>
> unfortunately I have to fire evtimer() thing to add EV_WRITE events.
> Doesn't sound good but I see no other way without bigger code refactoring.

Could we get two new events in library?
EV_PRE
EV_POST
that would fire specified function before (EV_PRE) and after (EV_POST)
processing any event.

So for example we watch 2 sockets (10 and 11) for reading and we:
event_set(&ev, -1, EV_PRE|EV_READ, some_function, NULL) - this would fire up
just before any other READ event for all watched sockets
event_set(&ev, 10, EV_PRE|EV_READ, some_function, NULL) - fire up before any
other READ event for socket 10
event_set(&ev, 10, EV_PRE|EV_POST|EV_READ, some_function, NULL) - fire up
some_function once before and once after any other READ event for socket 10
etc...

Using these I could just drop using evtimer*() and I wouldn't have any delay
in processing data.

--
Arkadiusz Miƛkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users


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

Reply via email to