tevent: add some debugging for timer events, that mostly matches samba3
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 18:52:47 +0000 (19:52 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 21:44:54 +0000 (22:44 +0100)
metze

lib/tevent/tevent_timed.c

index 78c8a24511a8002c8953136147652ad082d3318b..6f28159ed2d039a394e28eafdc29f435bbb118e4 100644 (file)
@@ -108,9 +108,14 @@ bool ev_timeval_is_zero(const struct timeval *tv)
 */
 static int tevent_common_timed_destructor(struct tevent_timer *te)
 {
+       tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE,
+                    "Destroying timer event %p \"%s\"\n",
+                    te, te->handler_name);
+
        if (te->event_ctx) {
                DLIST_REMOVE(te->event_ctx->timer_events, te);
        }
+
        return 0;
 }
 
@@ -158,6 +163,9 @@ struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev, TALLOC_C
 
        talloc_set_destructor(te, tevent_common_timed_destructor);
 
+       tevent_debug(ev, TEVENT_DEBUG_TRACE,
+                    "Added timed event \"%s\": %p\n",
+                    handler_name, te);
        return te;
 }
 
@@ -224,6 +232,10 @@ struct timeval tevent_common_loop_timer_delay(struct tevent_context *ev)
         * event from the list. */
        talloc_set_destructor(te, NULL);
 
+       tevent_debug(te->event_ctx, TEVENT_DEBUG_TRACE,
+                    "Ending timer event %p \"%s\"\n",
+                    te, te->handler_name);
+
        talloc_free(te);
 
        return ev_timeval_zero();