On Tue, Nov 6, 2012 at 7:37 AM, Nick Mathewson
<nickm@xxxxxxxxxxxxx> wrote:
Nick, Thanks for the quick response & help. Yes, I understand that correct way of doing this would be to have an API in bufferevent & taking BEV_LOCK().
The main reason for doing this is to avoid spending unfair amount of time on a single stream.
Is it true that the event_active() works only from a different thread? I see event_active() eventually calls event_callback_activate_nolock_() & it checks if the thread_id is different. So event if I create a separate event & call event_active() on that event, from the same thread, would it still work?
int
event_callback_activate_nolock_(struct event_base *base,
struct event_callback *evcb)
{
...
event_queue_insert_active(base, evcb);
if (EVBASE_NEED_NOTIFY(base)) <-----
evthread_notify_base(base);
return r;
}
#define EVBASE_NEED_NOTIFY(base) \
(evthread_id_fn_ != NULL && \
(base)->running_loop && \
(base)->th_owner_id != evthread_id_fn_()) <----
Again, Thanks for your help.