o Add a new bufferevent_socket_connect_hostname() to encapsulate the resolve-then-connect operation.
o Build kqueue.c correctly on GNU/kFreeBSD platforms. Patch pulled upstream from Debian.
o Alternative queue-based timeout algorithm for programs that use a large number of timeouts with the same value.
-
+ o New event_base_config option to disable the timeval cache entirely.
Changes in 2.0.2-alpha:
o Add a new flag to bufferevents to make all callbacks automatically deferred.
return (evutil_gettimeofday(tp, NULL));
}
+static inline void
+clear_time_cache(struct event_base *base)
+{
+ base->tv_cache.tv_sec = 0;
+}
+
+static inline void
+update_time_cache(struct event_base *base)
+{
+ base->tv_cache.tv_sec = 0;
+ if (!(base->flags & EVENT_BASE_FLAG_NO_CACHE_TIME))
+ gettime(base, &base->tv_cache);
+}
+
struct event_base *
event_init(void)
{
event_deferred_cb_queue_init(&base->defer_queue);
base->defer_queue.notify_fn = notify_base_cbq_callback;
base->defer_queue.notify_arg = base;
+ if (cfg)
+ base->flags = cfg->flags;
evmap_io_initmap(&base->io);
evmap_signal_initmap(&base->sigmap);
* as we invoke user callbacks. */
EVBASE_ACQUIRE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
- /* clear time cache */
- base->tv_cache.tv_sec = 0;
+ clear_time_cache(base);
if (base->sig.ev_signal_added)
evsig_base = base;
/* update last old time */
gettime(base, &base->event_tv);
- /* clear time cache */
- base->tv_cache.tv_sec = 0;
+ clear_time_cache(base);
res = evsel->dispatch(base, tv_p);
if (res == -1)
return (-1);
- gettime(base, &base->tv_cache);
+
+ update_time_cache(base);
timeout_process(base);
done = 1;
}
- /* clear time cache */
- base->tv_cache.tv_sec = 0;
+ clear_time_cache(base);
EVBASE_RELEASE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
an event_base. */
EVENT_BASE_FLAG_IGNORE_ENV = 0x02,
/** Windows only: enable the IOCP dispatcher at startup */
- EVENT_BASE_FLAG_STARTUP_IOCP = 0x04
+ EVENT_BASE_FLAG_STARTUP_IOCP = 0x04,
+ /** Instead of checking the current time every time the event loop is
+ ready to run timeout callbacks, check after each timeout callback.
+ */
+ EVENT_BASE_FLAG_NO_CACHE_TIME = 0x08
};
/**