-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

harry wrote:
> On Tue, May 01, 2007 at 10:38:50AM -0700, Steven Grimm wrote:
>> If you're calling event_init() more than once, you never want to call 
>> event_set() and other such functions. You want to call event_set_base() 
>> and pass in the handle you get back from event_init(). Using the 
>> current_base versions of the event calls in a multithreaded app (where 
>> you are using libevent from multiple threads in parallel) is almost 
>> certainly going to break your app.
>>
>> In the MT version of memcached I call event_init() in my startup thread 
>> and pass the handle to each of the worker threads I spawn. That way 
>> there's no chance of race conditions during initialization.
> 
> Thanks for the response.  I don't see an event_set_base() function.
> Do you mean event_base_set()?  My understanding is that you call
> event_set() to initialize the event structure and then call
> event_base_set() to change the event's base from current_base to
> whatever you got back from event_init().  Is this incorrect?
> 
Yes.

Also, I fixed the event_init() thread problem in my thread-safety patch
that was included a while ago. So, libevent trunk and possibly recent
releases do not have this problem.
I also solved several other thread problems, for loopexit() and for
interrupt signal handling.

Best regards,
   Wouter



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFGODP3kDLqNwOhpPgRAjRlAKCQKQ8xndjrhtHTEbDQR8BPCSxY9QCfWHcD
QKPtZ5I5RGBu0Y3jJhlCOD0=
=cqpO
-----END PGP SIGNATURE-----
_______________________________________________
Libevent-users mailing list
Libevent-users@monkey.org
http://monkey.org/mailman/listinfo/libevent-users

Reply via email to