From c1f06ac28fef5498952994e0399312b1fc567f22 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 10 May 2019 20:08:01 +0200 Subject: Implement asynchronous scope identifiers. Without entering an asynchronous scope, logs are the same before. When entering an asynchronous scope (either thread-based of scheduler/task-based), all log lines within an asynchronous scope contain its ID. Currently this is only used in GNU Taler, for debugging requests across multiple services. This allows us to get all log lines pertaining to a particular request for a user or another service. --- src/include/gnunet_scheduler_lib.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/include/gnunet_scheduler_lib.h') diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 3f4e3c9a8..3f0350f54 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h @@ -214,6 +214,8 @@ struct GNUNET_SCHEDULER_TaskContext }; + + /** * Function used by event-loop implementations to signal the scheduler * that a particular @a task is ready due to an event specified in the @@ -904,6 +906,24 @@ GNUNET_SCHEDULER_set_select (GNUNET_SCHEDULER_select new_select, void *new_select_cls); + +/** + * Change the async scope for the currently executing task and (transitively) + * for all tasks scheduled by the current task after calling this function. + * Nested tasks can begin their own nested async scope. + * + * Once the current task is finished, the async scope ID is reset to + * its previous value. + * + * Must only be called from a running task. + * + * @param aid the asynchronous scope id to enter + */ +void +GNUNET_SCHEDULER_begin_async_scope (struct GNUNET_AsyncScopeId *aid); + + + #if 0 /* keep Emacsens' auto-indent happy */ { #endif -- cgit v1.2.3