[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[Libevent-users] Re: newbie questions on rpc and threading in libevent



On Wed, Dec 22, 2010 at 3:24 AM, Wayne Shao <wshao99@xxxxxxxxx> wrote:
> Hi
> I find out about libevent when I was searching for some asych i/o framework
> with simple http handling + websocket.
> I have not read through the code yet. I have a few questions,
> 1) Threading:  Is i/o handling in a single threaded?  Is read callback
> invoked inline from the same thread that handles epoll events?

Unless you explicitly call for multiple threads (by launching them
yourself, or by telling Libevent it can use IOCP) , Libevent won't
launch multiple IO threads for you.

> 2) RPC: from the doc "libevents provides a framework for creating RPC
> servers and clients". Is there an example of this? What kind of RPC?  (e.g,
> is there anyway to hack it with Facebook Thrift)

That's handled by the code in evrpc.c and by stub code generated by
event_rpcgen.py.   It's one of the last modules I haven't figured out
and documented yet.  It seems to be an ad hoc RPC format that Niels
designed.  For more information on its use, your best bet is the
doxygen documentation in event2/rpc.h ; you might also want to check
out the unit tests in regress_rpc.c .

If somebody wants to write better documentation, or some nice clean
sample code for the samples/ directory, that would be much
appreciated.

(As a heads-up: no work has been done to make the http or rpc modules
thread-safe, so you shouldn't use the same http or rpc data structures
from two threads at once.)

happy new year,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.