Make event_pending() threadsafe.

(Commit message by Nick)
This commit is contained in:
Simon Liu 2012-06-15 01:01:05 +08:00 committed by Nick Mathewson
parent 117e3273dc
commit be7a95c629

View File

@ -1846,6 +1846,7 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
{
int flags = 0;
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
_event_debug_assert_is_setup(ev);
if (ev->ev_flags & EVLIST_INSERTED)
@ -1869,6 +1870,8 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
#endif
}
EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
return (flags & event);
}