o Treat an event with a negative fd as valid but untriggerable by Libevent. This is useful for applications that want to manually activate events.
o Fix compilation on Android, which forgot to define fd_mask in its sys/select.h
o Do not drop data from evbuffer when out of memory; reported by Jacek Masiulaniec
-
+ o New event_base_got_exit() and event_base_got_break() functions to tell whether an event loop exited because of an event_base_loopexit() or an event_base_loopbreak(). Patch from Ka-Hing Cheung.
+
Changes in 2.0.2-alpha:
o Add a new flag to bufferevents to make all callbacks automatically deferred.
}
}
+int
+event_base_got_break(struct event_base *event_base)
+{
+ int res;
+ EVBASE_ACQUIRE_LOCK(event_base, EVTHREAD_READ, th_base_lock);
+ res = event_base->event_break;
+ EVBASE_RELEASE_LOCK(event_base, EVTHREAD_READ, th_base_lock);
+ return res;
+}
+int
+event_base_got_exit(struct event_base *event_base)
+{
+ int res;
+ EVBASE_ACQUIRE_LOCK(event_base, EVTHREAD_READ, th_base_lock);
+ res = event_base->event_gotterm;
+ EVBASE_RELEASE_LOCK(event_base, EVTHREAD_READ, th_base_lock);
+ return res;
+}
/* not thread safe */
base->th_owner_id = EVTHREAD_GET_ID();
#endif
+ base->event_gotterm = base->event_break = 0;
+
while (!done) {
/* Terminate the loop if we have been asked to */
if (base->event_gotterm) {
- base->event_gotterm = 0;
break;
}
if (base->event_break) {
- base->event_break = 0;
break;
}
*/
int event_base_loopbreak(struct event_base *);
+/**
+ Checks if the event loop was told to exit by event_loopexit().
+
+ This function will return true for an event_base at every point after
+ event_loopexit() is called, until the event loop is next entered.
+
+ @param eb the event_base structure returned by event_init()
+ @return true if event_base_loopexit() was called on this event base,
+ or 0 otherwise
+ @see event_base_loopexit
+ @see event_base_got_break
+ */
+int event_base_got_exit(struct event_base *);
+
+/**
+ Checks if the event loop was told to abort immediately by event_loopbreak().
+
+ This function will return true for an event_base at every point after
+ event_loopbreak() is called, until the event loop is next entered.
+
+ @param eb the event_base structure returned by event_init()
+ @return true if event_base_loopbreak() was called on this event base,
+ or 0 otherwise
+ @see event_base_loopbreak
+ @see event_base_got_exit
+ */
+int event_base_got_break(struct event_base *);
+
/* Flags to pass to event_set(), event_new(), event_assign(),
* event_pending(), and anything else with an argument of the form
* "short events" */