This function is particularly useful for selectively increasing
the accuracy of the cached time value in 'base' during callbacks
that take a long time to execute.
This function has no effect if the base is currently not in its
event loop or if timeval caching is disabled via EVENT_BASE_FLAG_NO_CACHE_TIME.
gettime(base, &base->tv_cache);
}
+int
+event_base_update_cache_time(struct event_base *base)
+{
+
+ if (!base) {
+ base = current_base;
+ if (!current_base)
+ return -1;
+ }
+
+ EVBASE_ACQUIRE_LOCK(base, th_base_lock);
+ update_time_cache(base);
+ EVBASE_RELEASE_LOCK(base, th_base_lock);
+ return 0;
+}
+
struct event_base *
event_init(void)
{
int event_base_gettimeofday_cached(struct event_base *base,
struct timeval *tv);
+/** Update cached_tv in the 'base' to the current time
+ *
+ * You can use this function is useful for selectively increasing
+ * the accuracy of the cached time value in 'base' during callbacks
+ * that take a long time to execute.
+ *
+ * This function has no effect if the base is currently not in its
+ * event loop, or if timeval caching is disabled via
+ * EVENT_BASE_FLAG_NO_CACHE_TIME.
+ *
+ * @return 0 on success, -1 on failure
+ */
+int event_base_update_cache_time(struct event_base *base);
+
#ifdef __cplusplus
}
#endif