From 06ec5de6154a6eb2df0a3a901b59a4d0f1cc61bb Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Sat, 16 Jun 2018 17:39:34 -0600 Subject: [PATCH] Add convenience macros for user-triggered events Signed-off-by: Philip Prindeville Closes: #647 (picked) (cherry picked from commit d2acf67ec3ad2916236396992f094c0c65016028) --- include/event2/event.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/include/event2/event.h b/include/event2/event.h index af56c9ed..a95b5b9d 100644 --- a/include/event2/event.h +++ b/include/event2/event.h @@ -963,11 +963,13 @@ int event_base_got_break(struct event_base *); /** @name evtimer_* macros - Aliases for working with one-shot timer events */ + Aliases for working with one-shot timer events + If you need EV_PERSIST timer use event_*() functions. + */ /**@{*/ #define evtimer_assign(ev, b, cb, arg) \ event_assign((ev), (b), -1, 0, (cb), (arg)) -#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg)) +#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg)) #define evtimer_add(ev, tv) event_add((ev), (tv)) #define evtimer_del(ev) event_del(ev) #define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv)) @@ -990,6 +992,20 @@ int event_base_got_break(struct event_base *); #define evsignal_initialized(ev) event_initialized(ev) /**@}*/ +/** + @name evuser_* macros + + Aliases for working with user-triggered events + If you need EV_PERSIST event use event_*() functions. + */ +/**@{*/ +#define evuser_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg)) +#define evuser_del(ev) event_del(ev) +#define evuser_pending(ev, tv) event_pending((ev), 0, (tv)) +#define evuser_initialized(ev) event_initialized(ev) +#define evuser_trigger(ev) event_active((ev), 0, 0) +/**@}*/ + /** A callback function for an event. -- 2.40.0