diff options
Diffstat (limited to 'src/util/scheduler.c')
-rw-r--r-- | src/util/scheduler.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index 6405ea336..dcf5aeeaa 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -256,6 +256,11 @@ static int current_lifeness; | |||
256 | static GNUNET_SCHEDULER_select scheduler_select; | 256 | static GNUNET_SCHEDULER_select scheduler_select; |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * Task context of the current task. | ||
260 | */ | ||
261 | static struct GNUNET_SCHEDULER_TaskContext tc; | ||
262 | |||
263 | /** | ||
259 | * Closure for #scheduler_select. | 264 | * Closure for #scheduler_select. |
260 | */ | 265 | */ |
261 | static void *scheduler_select_cls; | 266 | static void *scheduler_select_cls; |
@@ -533,7 +538,6 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, | |||
533 | { | 538 | { |
534 | enum GNUNET_SCHEDULER_Priority p; | 539 | enum GNUNET_SCHEDULER_Priority p; |
535 | struct GNUNET_SCHEDULER_Task *pos; | 540 | struct GNUNET_SCHEDULER_Task *pos; |
536 | struct GNUNET_SCHEDULER_TaskContext tc; | ||
537 | 541 | ||
538 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; | 542 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; |
539 | do | 543 | do |
@@ -584,7 +588,7 @@ run_ready (struct GNUNET_NETWORK_FDSet *rs, | |||
584 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 588 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
585 | "Running task: %p\n", | 589 | "Running task: %p\n", |
586 | pos); | 590 | pos); |
587 | pos->callback (pos->callback_cls, &tc); | 591 | pos->callback (pos->callback_cls); |
588 | #if EXECINFO | 592 | #if EXECINFO |
589 | unsigned int i; | 593 | unsigned int i; |
590 | 594 | ||
@@ -902,17 +906,16 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | |||
902 | 906 | ||
903 | 907 | ||
904 | /** | 908 | /** |
905 | * Obtain the reason code for why the current task was | 909 | * Obtain the task context, giving the reason why the current task was |
906 | * started. Will return the same value as | 910 | * started. |
907 | * the `struct GNUNET_SCHEDULER_TaskContext`'s reason field. | ||
908 | * | 911 | * |
909 | * @return reason(s) why the current task is run | 912 | * @return current tasks' scheduler context |
910 | */ | 913 | */ |
911 | enum GNUNET_SCHEDULER_Reason | 914 | const struct GNUNET_SCHEDULER_TaskContext * |
912 | GNUNET_SCHEDULER_get_reason () | 915 | GNUNET_SCHEDULER_get_task_context () |
913 | { | 916 | { |
914 | GNUNET_assert (NULL != active_task); | 917 | GNUNET_assert (NULL != active_task); |
915 | return active_task->reason; | 918 | return &tc; |
916 | } | 919 | } |
917 | 920 | ||
918 | 921 | ||