Lines Matching defs:event
27 #include "event2/event-config.h"
56 #include "event2/event.h"
59 #include "event-internal.h"
136 static void event_queue_insert_timeout(struct event_base *, struct event *);
137 static void event_queue_insert_inserted(struct event_base *, struct event *);
140 static void event_queue_remove_timeout(struct event_base *, struct event *);
141 static void event_queue_remove_inserted(struct event_base *, struct event *);
145 static int event_del_(struct event *ev, int blocking);
149 static void event_queue_reinsert_timeout(struct event_base *,struct event *, int was_common, int is_common, int old_timeout_idx);
159 static inline void event_signal_closure(struct event_base *, struct event *ev);
160 static inline void event_persist_closure(struct event_base *, struct event *ev);
165 struct event *ev);
168 /* These functions implement a hashtable of which 'struct event *' structures
170 * event itself, since we're trying to work through cases where an event gets
176 const struct event *ptr;
189 * and every struct event is over 64 bytes in size, so we can
261 "%s: noting an add on a non-setup event %p" \
282 "%s: noting a del on a non-setup event %p" \
301 "%s called on a non-initialized event %p" \
320 "%s called on an already added event %p" \
435 static inline struct event *
439 return EVUTIL_UPCAST(evcb, struct event, ev_evcallback);
443 event_to_event_callback(struct event *ev)
640 event_warnx("%s: no event mechanism available",
650 /* allocate a single active event queue */
720 struct event *ev = event_callback_to_event(evcb);
736 struct event *ev = event_callback_to_event(evcb);
756 struct event *ev;
799 struct event *next = TAILQ_NEXT(ev,
875 * so that we can call event_del() on an event without telling the backend.
893 /* reinitialize the event base after a fork */
906 /* check if this event mechanism requires reinit on the backend */
922 * get received by one or both of the event loops, more or less at
968 "%s: could not reinitialize event mechanism",
978 /* Tell the event maps to re-inform the backend about all
980 * event get re-created if necessary. */
1264 event_signal_closure(struct event_base *base, struct event *ev)
1357 /* Add the timeout for the first event in given common timeout list to the
1361 const struct timeval *now, struct event *head)
1369 * This means that (at least) the first event in that queue should be run,
1377 struct event *ev = NULL;
1470 /* Closure function invoked when we're activating a persistent event. */
1472 event_persist_closure(struct event_base *base, struct event *ev)
1481 /* reschedule the persistent event if we have a timeout. */
1513 * a clock jump, not running the event loop for a
1554 struct event *ev=NULL;
1563 "event_process_active: event: %p, %s%s%scall %p",
1610 void (*evcb_evfinalize)(struct event *, void *);
1699 break; /* Processed a real event; do not
1948 /* not threadsafe, event scheduled once. */
1957 /* Schedules an event once */
1982 /* If the event is going to become active immediately,
1993 /* Bad event combination */
2018 event_assign(struct event *ev, struct event_base *base, evutil_socket_t fd, short events, void (*callback)(evutil_socket_t, short, void *), void *arg)
2067 event_base_set(struct event_base *base, struct event *ev)
2082 event_set(struct event *ev, evutil_socket_t fd, short events,
2096 struct event *
2099 struct event *ev = NULL;
2110 struct event *
2113 struct event *ev;
2114 ev = mm_malloc(sizeof(struct event));
2126 event_free(struct event *ev)
2132 /* make sure that this event won't be coming back to haunt us. */
2140 event_debug_unassign(struct event *ev)
2150 event_finalize_nolock_(struct event_base *base, unsigned flags, struct event *ev, event_finalize_callback_fn cb)
2164 event_finalize_impl_(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
2169 event_warnx("%s: event has no event_base set.", __func__);
2180 event_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
2186 event_free_finalize(unsigned flags, struct event *ev, event_finalize_callback_fn cb)
2194 struct event *ev = NULL;
2254 * Set's the priority of an event - if an event is already scheduled
2259 event_priority_set(struct event *ev, int pri)
2274 * Checks if a specific event is pending or scheduled.
2278 event_pending(const struct event *ev, short event, struct timeval *tv)
2283 event_warnx("%s: event has no event_base set.", __func__);
2297 event &= (EV_TIMEOUT|EV_READ|EV_WRITE|EV_CLOSED|EV_SIGNAL);
2300 if (tv != NULL && (flags & event & EV_TIMEOUT)) {
2309 return (flags & event);
2313 event_initialized(const struct event *ev)
2322 event_get_assignment(const struct event *event, struct event_base **base_out, evutil_socket_t *fd_out, short *events_out, event_callback_fn *callback_out, void **arg_out)
2324 event_debug_assert_is_setup_(event);
2327 *base_out = event->ev_base;
2329 *fd_out = event->ev_fd;
2331 *events_out = event->ev_events;
2333 *callback_out = event->ev_callback;
2335 *arg_out = event->ev_arg;
2341 return sizeof(struct event);
2345 event_get_fd(const struct event *ev)
2352 event_get_base(const struct event *ev)
2359 event_get_events(const struct event *ev)
2366 event_get_callback(const struct event *ev)
2373 event_get_callback_arg(const struct event *ev)
2380 event_get_priority(const struct event *ev)
2387 event_add(struct event *ev, const struct timeval *tv)
2392 event_warnx("%s: event has no event_base set.", __func__);
2407 * listening on the other end will wake up as the corresponding event
2455 /* Implementation function to remove a timeout on a currently pending event.
2458 event_remove_timer_nolock_(struct event *ev)
2465 event_debug(("event_remove_timer_nolock: event: %p", ev));
2477 event_remove_timer(struct event *ev)
2482 event_warnx("%s: event has no event_base set.", __func__);
2495 /* Implementation function to add an event. Works just like event_add,
2500 event_add_nolock_(struct event *ev, const struct timeval *tv,
2511 "event_add: event: %p (fd "EV_SOCK_FMT"), %s%s%s%scall %p",
2537 /* If the main thread is currently executing a signal event's
2539 * until the callback is done before we mess with the event, or else
2566 * we should change the timeout state only if the previous event
2579 * timeout value and re-add the event.
2599 * this event in a loop
2631 "event_add: event %p, timeout in %d seconds %d useconds, call %p",
2647 struct event* top = NULL;
2672 event_del_(struct event *ev, int blocking)
2677 event_warnx("%s: event has no event_base set.", __func__);
2691 event_del(struct event *ev)
2697 event_del_block(struct event *ev)
2703 event_del_noblock(struct event *ev)
2714 event_del_nolock_(struct event *ev, int blocking)
2722 /* An event without a base has not been added */
2735 /* If the main thread is currently executing this event's callback,
2737 * callback is done before we start removing the event. That way,
2753 /* See if we are just active executing this event in a loop */
2763 * deleted timeout event: all that could happen if we don't is
2800 event_active(struct event *ev, int res, short ncalls)
2803 event_warnx("%s: event has no event_base set.", __func__);
2818 event_active_nolock_(struct event *ev, int res, short ncalls)
2869 event_active_later_(struct event *ev, int res)
2877 event_active_later_nolock_(struct event *ev, int res)
3042 struct event *ev;
3068 event_debug(("timeout_next: event: %p, in %d seconds, %d useconds", ev, (int)tv->tv_sec, (int)tv->tv_usec));
3074 /* Activate every event whose timeout has elapsed. */
3080 struct event *ev;
3092 /* delete this event from the I/O queues */
3095 event_debug(("timeout_process: event: %p, call %p",
3123 event_queue_remove_inserted(struct event_base *base, struct event *ev)
3166 event_queue_remove_timeout(struct event_base *base, struct event *ev)
3190 event_queue_reinsert_timeout(struct event_base *base, struct event *ev,
3231 struct event *ev)
3233 struct event *e;
3236 * timeout} + {the time when we add the event}, and so the events
3260 event_queue_insert_inserted(struct event_base *base, struct event *ev)
3314 event_queue_insert_timeout(struct event_base *base, struct event *ev)
3543 /* No need to add an event here; the backend can wake
3567 /* prepare an event that we can use for wakeup */
3571 /* we need to mark this as internal event */
3584 struct event *ev;
3624 /* This isn't an event (evlist_init clear), or
3638 /* Helper for event_base_dump_events: called on each event in the event base;
3641 dump_inserted_event_fn(const struct event_base *base, const struct event *e, void *arg)
3671 /* Helper for event_base_dump_events: called on each event in the event base;
3674 dump_active_event_fn(const struct event_base *base, const struct event *e, void *arg)
3845 struct event *ev, *p_ev;
3856 struct event *last=NULL, *ev;
3858 EVUTIL_ASSERT_TAILQ_OK(&ctl->events, event, ev_timeout_pos.ev_next_with_common_timeout);