On Saturday 03 June 2006 11:00, Martin Hedenfalk wrote:
> Without looking at the patch or the code, from your description you
> add EV_WRITE directly on the accepted socket. Could that be the reason
> your code spins in the event callback with nothing to do and causing
> CPU usage to rise?

I've started redoing things to avoid EV_WRITE but it's quite problematic in 
current tpop3d since it was working in such way:

while (1) {
      do_FS_SET(read_fdset);
      find_out_if_there_is_something
      in_internal_buffers_to_be_written_to_sockets
      and_do_FD_SET(write_fdset);
      select()
      do_processing();
}

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.

> Just a thought.
> /Martin


-- 
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

Reply via email to