tevent: add trace points BEFORE_LOOP_ONCE and AFTER_LOOP_ONCE
authorMichael Adam <obnox@samba.org>
Tue, 26 Feb 2013 14:54:57 +0000 (15:54 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Mar 2013 09:48:38 +0000 (10:48 +0100)
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 <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/testsuite.c
lib/tevent/tevent.c
lib/tevent/tevent.h

index e05368204747bcf229b941af2534c67ec5736451..142ba4f7256c1e04af0fcbb8ec4ff606aad5de90 100644 (file)
@@ -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;
        }
 }
 
index 3b273d6c531101954bf752f4d408ae7de88f4b5b..63d5f1536c9410e4133b483ee6853d2abee9700c 100644 (file)
@@ -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;
                }
index dc61912be7439f341b3e8d34eaee210964a3691d..6b4d371e4c5dae31307eaa2b6ea973cd7c148036 100644 (file)
@@ -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,