tevent: optimize adding new zero timer events
[metze/samba/wip.git] / lib / tevent / tevent_internal.h
index 8433333558366af2c754823ce2df9cdf830ce28f..b239e7403a77c37ca78d3ab7f4e0b3814eb5a5bf 100644 (file)
@@ -263,6 +263,13 @@ struct tevent_context {
                tevent_trace_callback_t callback;
                void *private_data;
        } tracing;
+
+       /*
+        * an optimization pointer into timer_events
+        * used by used by common code via
+        * tevent_common_add_timer_v2()
+        */
+       struct tevent_timer *last_zero_timer;
 };
 
 const struct tevent_ops *tevent_find_ops_byname(const char *name);
@@ -292,6 +299,13 @@ struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev,
                                             void *private_data,
                                             const char *handler_name,
                                             const char *location);
+struct tevent_timer *tevent_common_add_timer_v2(struct tevent_context *ev,
+                                               TALLOC_CTX *mem_ctx,
+                                               struct timeval next_event,
+                                               tevent_timer_handler_t handler,
+                                               void *private_data,
+                                               const char *handler_name,
+                                               const char *location);
 struct timeval tevent_common_loop_timer_delay(struct tevent_context *);
 
 void tevent_common_schedule_immediate(struct tevent_immediate *im,