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

Re: [Libevent-users] Threaded event bases



On Dec 21, 2010, at 12:29 , Mark Ellzey wrote:
I've never had much luck with event_active across multiple threads,
though this may be because of my own ignorance. This also does not
tell the thread *what* to do, just that it needs to do *something*.

Well, there were bugs in it until recently. As in, a commit between 2.0.9 and 2.0.10 that would prevent this from working as designed:

http://levent.git.sourceforge.net/git/gitweb.cgi?p=levent/levent;a=commit;h=5beeec9d43cbf7de700a9a0fd7d144a341e102c2

event_active takes a struct event*, so it does tell the thread what to do: it triggers a specific callback in an event_loop, which can be across threads. I use this in one program to implement a thread pool: I have a "main" event_loop which does most network I/O processing, then I use event_active to pass some specific tasks to other t threads.

Evan

--
Evan Jones
http://evanjones.ca/

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