diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-02-22 12:45:39 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-03-01 12:01:54 -0800 |
commit | 35385a3e28850d0915e8cf2883871ae2101526f1 (patch) | |
tree | 79cc502e6efe9bca3d84a8663d202fe80aa71e60 /lib/tevent/tevent_internal.h | |
parent | afd4198bf1ee5877a660d42e615e06d895690161 (diff) | |
download | samba-35385a3e28850d0915e8cf2883871ae2101526f1.tar.gz samba-35385a3e28850d0915e8cf2883871ae2101526f1.tar.bz2 samba-35385a3e28850d0915e8cf2883871ae2101526f1.zip |
tevent: optimize adding new zero timer events
Such events were used before we had immediate events.
It's likely that there're a lot of this events
and we need to add new ones in fifo order.
The tricky part is that tevent_common_add_timer()
should not use the optimization as it's used
by broken Samba versions, which don't use
tevent_common_loop_timer_delay() in source3/lib/events.c.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/tevent/tevent_internal.h')
-rw-r--r-- | lib/tevent/tevent_internal.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index 8433333558..b239e7403a 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -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, |