From 883d20a9bf7444e6338e13d6efbcbc257e1d78b7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 26 Feb 2013 15:54:57 +0100 Subject: tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE The define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS can be used to detect the new feature, without writing configure tests. Pair-Programmed-With: Stefan Metzmacher Signed-off-by: Michael Adam Signed-off-by: Stefan Metzmacher --- lib/tevent/testsuite.c | 3 +++ lib/tevent/tevent.c | 4 ++++ lib/tevent/tevent.h | 11 +++++++++++ 3 files changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c index e0536820474..142ba4f7256 100644 --- a/lib/tevent/testsuite.c +++ b/lib/tevent/testsuite.c @@ -194,6 +194,9 @@ static void test_event_threaded_trace(enum tevent_trace_point point, case TEVENT_TRACE_AFTER_WAIT: test_event_threaded_lock(); break; + case TEVENT_TRACE_BEFORE_LOOP_ONCE: + case TEVENT_TRACE_AFTER_LOOP_ONCE: + break; } } diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 3b273d6c531..63d5f1536c9 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -525,7 +525,9 @@ int _tevent_loop_once(struct tevent_context *ev, const char *location) } } + tevent_trace_point_callback(ev, TEVENT_TRACE_BEFORE_LOOP_ONCE); ret = ev->ops->loop_once(ev, location); + tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); if (ev->nesting.level > 0) { if (ev->nesting.hook_fn) { @@ -585,7 +587,9 @@ int _tevent_loop_until(struct tevent_context *ev, } while (!finished(private_data)) { + tevent_trace_point_callback(ev, TEVENT_TRACE_BEFORE_LOOP_ONCE); ret = ev->ops->loop_once(ev, location); + tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_LOOP_ONCE); if (ret != 0) { break; } diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index dc61912be74..6b4d371e4c5 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -524,6 +524,17 @@ enum tevent_trace_point { * Corresponds to a trace point just after waiting */ TEVENT_TRACE_AFTER_WAIT, +#define TEVENT_HAS_LOOP_ONCE_TRACE_POINTS 1 + /** + * Corresponds to a trace point just before calling + * the loop_once() backend function. + */ + TEVENT_TRACE_BEFORE_LOOP_ONCE, + /** + * Corresponds to a trace point right after the + * loop_once() backend function has returned. + */ + TEVENT_TRACE_AFTER_LOOP_ONCE, }; typedef void (*tevent_trace_callback_t)(enum tevent_trace_point, -- cgit