mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Make event_pending() threadsafe.
(Commit message by Nick)
This commit is contained in:
parent
117e3273dc
commit
be7a95c629
3
event.c
3
event.c
@ -1846,6 +1846,7 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
|
|||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
|
EVBASE_ACQUIRE_LOCK(ev->ev_base, th_base_lock);
|
||||||
_event_debug_assert_is_setup(ev);
|
_event_debug_assert_is_setup(ev);
|
||||||
|
|
||||||
if (ev->ev_flags & EVLIST_INSERTED)
|
if (ev->ev_flags & EVLIST_INSERTED)
|
||||||
@ -1869,6 +1870,8 @@ event_pending(const struct event *ev, short event, struct timeval *tv)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EVBASE_RELEASE_LOCK(ev->ev_base, th_base_lock);
|
||||||
|
|
||||||
return (flags & event);
|
return (flags & event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user