]> granicus.if.org Git - libevent/commitdiff
Add convenience macros for user-triggered events
authorPhilip Prindeville <philipp@redfish-solutions.com>
Sat, 16 Jun 2018 23:39:34 +0000 (17:39 -0600)
committerAzat Khuzhin <azat@libevent.org>
Sat, 2 Feb 2019 12:17:57 +0000 (15:17 +0300)
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Closes: #647 (picked)
(cherry picked from commit d2acf67ec3ad2916236396992f094c0c65016028)

include/event2/event.h

index af56c9ed93393ec2b564278432f0b773aa6a32c6..a95b5b9df57df1959d7d15a66912b31e6cffdf8e 100644 (file)
@@ -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.