diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
commit | 29e6158507a0758192075ac6ece7ba8e75ddc49a (patch) | |
tree | b91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/regex/gnunet-regex-profiler.c | |
parent | 5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff) | |
download | gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip |
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/regex/gnunet-regex-profiler.c')
-rw-r--r-- | src/regex/gnunet-regex-profiler.c | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/src/regex/gnunet-regex-profiler.c b/src/regex/gnunet-regex-profiler.c index 5fe6186cf..5938c99b1 100644 --- a/src/regex/gnunet-regex-profiler.c +++ b/src/regex/gnunet-regex-profiler.c | |||
@@ -384,10 +384,9 @@ stats_connect_cb (void *cls, | |||
384 | * Start announcing the next regex in the DHT. | 384 | * Start announcing the next regex in the DHT. |
385 | * | 385 | * |
386 | * @param cls Index of the next peer in the peers array. | 386 | * @param cls Index of the next peer in the peers array. |
387 | * @param tc TaskContext. | ||
388 | */ | 387 | */ |
389 | static void | 388 | static void |
390 | announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 389 | announce_next_regex (void *cls); |
391 | 390 | ||
392 | 391 | ||
393 | /******************************************************************************/ | 392 | /******************************************************************************/ |
@@ -399,10 +398,9 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
399 | * Shutdown nicely | 398 | * Shutdown nicely |
400 | * | 399 | * |
401 | * @param cls NULL | 400 | * @param cls NULL |
402 | * @param tc the task context | ||
403 | */ | 401 | */ |
404 | static void | 402 | static void |
405 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 403 | do_shutdown (void *cls) |
406 | { | 404 | { |
407 | struct RegexPeer *peer; | 405 | struct RegexPeer *peer; |
408 | unsigned int peer_cnt; | 406 | unsigned int peer_cnt; |
@@ -471,10 +469,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
471 | * abort task to run on test timed out | 469 | * abort task to run on test timed out |
472 | * | 470 | * |
473 | * @param cls NULL | 471 | * @param cls NULL |
474 | * @param tc the task context | ||
475 | */ | 472 | */ |
476 | static void | 473 | static void |
477 | do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 474 | do_abort (void *cls) |
478 | { | 475 | { |
479 | unsigned long i = (unsigned long) cls; | 476 | unsigned long i = (unsigned long) cls; |
480 | 477 | ||
@@ -664,10 +661,9 @@ stats_connect_cb (void *cls, | |||
664 | * profiler, when done. | 661 | * profiler, when done. |
665 | * | 662 | * |
666 | * @param cls NULL | 663 | * @param cls NULL |
667 | * @param tc the task context | ||
668 | */ | 664 | */ |
669 | static void | 665 | static void |
670 | do_collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 666 | do_collect_stats (void *cls) |
671 | { | 667 | { |
672 | struct RegexPeer *peer = &peers[0]; | 668 | struct RegexPeer *peer = &peers[0]; |
673 | 669 | ||
@@ -694,10 +690,9 @@ do_collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
694 | * Start searching for the next string in the DHT. | 690 | * Start searching for the next string in the DHT. |
695 | * | 691 | * |
696 | * @param cls Index of the next peer in the peers array. | 692 | * @param cls Index of the next peer in the peers array. |
697 | * @param tc TaskContext. | ||
698 | */ | 693 | */ |
699 | static void | 694 | static void |
700 | find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | 695 | find_string (void *cls); |
701 | 696 | ||
702 | 697 | ||
703 | /** | 698 | /** |
@@ -808,10 +803,9 @@ regex_found_handler (void *cls, | |||
808 | * specified timeout 'search_timeout'. | 803 | * specified timeout 'search_timeout'. |
809 | * | 804 | * |
810 | * @param cls NULL | 805 | * @param cls NULL |
811 | * @param tc the task context | ||
812 | */ | 806 | */ |
813 | static void | 807 | static void |
814 | search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | 808 | search_timed_out (void *cls) |
815 | { | 809 | { |
816 | unsigned int i; | 810 | unsigned int i; |
817 | 811 | ||
@@ -846,15 +840,15 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc) | |||
846 | * but we should start another one. | 840 | * but we should start another one. |
847 | * | 841 | * |
848 | * @param cls Index of the next peer in the peers array. | 842 | * @param cls Index of the next peer in the peers array. |
849 | * @param tc TaskContext. | ||
850 | */ | 843 | */ |
851 | static void | 844 | static void |
852 | find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 845 | find_timed_out (void *cls) |
853 | { | 846 | { |
854 | struct RegexPeer *p = cls; | 847 | struct RegexPeer *p = cls; |
848 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
855 | 849 | ||
856 | p->timeout = NULL; | 850 | p->timeout = NULL; |
857 | 851 | tc = GNUNET_SCHEDULER_get_task_context (); | |
858 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) | 852 | if ((tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0) |
859 | return; | 853 | return; |
860 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 854 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
@@ -870,13 +864,14 @@ find_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
870 | * Start searching for a string in the DHT. | 864 | * Start searching for a string in the DHT. |
871 | * | 865 | * |
872 | * @param cls Index of the next peer in the peers array. | 866 | * @param cls Index of the next peer in the peers array. |
873 | * @param tc TaskContext. | ||
874 | */ | 867 | */ |
875 | static void | 868 | static void |
876 | find_string (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 869 | find_string (void *cls) |
877 | { | 870 | { |
878 | unsigned int search_peer = (unsigned int) (long) cls; | 871 | unsigned int search_peer = (unsigned int) (long) cls; |
872 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
879 | 873 | ||
874 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
880 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || | 875 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) || |
881 | search_peer >= num_peers || | 876 | search_peer >= num_peers || |
882 | GNUNET_YES == in_shutdown) | 877 | GNUNET_YES == in_shutdown) |
@@ -962,7 +957,7 @@ daemon_started (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
962 | * @param tc the task context | 957 | * @param tc the task context |
963 | */ | 958 | */ |
964 | static void | 959 | static void |
965 | do_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 960 | do_announce (void *cls) |
966 | { | 961 | { |
967 | unsigned int i; | 962 | unsigned int i; |
968 | 963 | ||
@@ -982,13 +977,14 @@ do_announce (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
982 | * Start announcing the next regex in the DHT. | 977 | * Start announcing the next regex in the DHT. |
983 | * | 978 | * |
984 | * @param cls Closure (unused). | 979 | * @param cls Closure (unused). |
985 | * @param tc TaskContext. | ||
986 | */ | 980 | */ |
987 | static void | 981 | static void |
988 | announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 982 | announce_next_regex (void *cls) |
989 | { | 983 | { |
990 | struct RegexPeer *peer; | 984 | struct RegexPeer *peer; |
985 | const struct GNUNET_SCHEDULER_TaskContext *tc; | ||
991 | 986 | ||
987 | tc = GNUNET_SCHEDULER_get_task_context (); | ||
992 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 988 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
993 | return; | 989 | return; |
994 | if (next_search >= num_peers) | 990 | if (next_search >= num_peers) |