It's unsafe for two threads to call event_init() in parallel because
it sets and returns the global current_base variable.  If the first 
thread gets preempted by the second after calloc() but before the 
return, both calls will return the same value.

My question is whether one should be concerned about the use of 
current_base in other parts of the code.  For example, event_set() 
uses current_base while setting the priority.  Is there any chance 
that a preemption will occur in the middle of retrieving the value of
current_base resulting in an invalid pointer?

Also, I assume that each process that loads libevent as a shared 
object must get its own copy of current_base, right?

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

Reply via email to