I am running libevent-dev on 32 bit Kubuntu. (whichever the verision is for
kubuntu 7)

I have made a simple socket reader in which I listen for new connections on
a socket with  EV_READ |  EV_PERSIST which calls an acceptor callback.
Inside that callback, I construct a new socket with accept and then put a
data_reader type callback with EV_READ | EV_PERSIST as well.

In the data_reader callback, I push the socket info into a work queue that
is handled by a thread pool. This is where things get wierd, I can read read
from the socket from the other thread just fine, but libevent often fires an
additional 30-110 events, it's like it keeps firing the event until I read
the data, is this the correct behavior?

Note that when I leave the threadpool out and read the data immediately in
the callback function, it does not cause multiple read events to occur.

For performance reasons what I'd really like to do is let an available
thread in the pool own/read/write a socket when it has data to be read. This
allows the main thead to get back to accepting connections and handling read
events. It also keeps me from having to copy the data out of the socket and
put it into a mutexed buffer or copy to thread-local storage. Is this
possible?


Any help would be appreciated.

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

Reply via email to