diff --git a/event.c b/event.c index 28fa8d0e..3bc16bab 100644 --- a/event.c +++ b/event.c @@ -2072,6 +2072,13 @@ event_get_callback_arg(const struct event *ev) return ev->ev_arg; } +int +event_get_priority(const struct event *ev) +{ + event_debug_assert_is_setup_(ev); + return ev->ev_pri; +} + int event_add(struct event *ev, const struct timeval *tv) { diff --git a/include/event2/event.h b/include/event2/event.h index f1331f62..1cfc3ce9 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -1124,6 +1124,12 @@ event_callback_fn event_get_callback(const struct event *ev); */ void *event_get_callback_arg(const struct event *ev); +/** + Return the priority of an event. + @see event_priority_init(), event_get_priority() +*/ +int event_get_priority(const struct event *ev); + /** Extract _all_ of arguments given to construct a given event. The event_base is copied into *base_out, the fd is copied into *fd_out, and so @@ -1226,7 +1232,7 @@ int event_base_get_npriorities(struct event_base *eb); @param ev an event struct @param priority the new priority to be assigned @return 0 if successful, or -1 if an error occurred - @see event_priority_init() + @see event_priority_init(), event_get_priority() */ int event_priority_set(struct event *, int);