diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arm/Makefile.am | 3 | ||||
-rw-r--r-- | src/dht/Makefile.am | 3 | ||||
-rw-r--r-- | src/include/gnunet_scheduler_lib.h | 16 | ||||
-rw-r--r-- | src/integration-tests/Makefile.am | 3 | ||||
-rw-r--r-- | src/statistics/Makefile.am | 3 | ||||
-rw-r--r-- | src/util/scheduler.c | 48 |
6 files changed, 57 insertions, 19 deletions
diff --git a/src/arm/Makefile.am b/src/arm/Makefile.am index 373847fde..b1706a479 100644 --- a/src/arm/Makefile.am +++ b/src/arm/Makefile.am | |||
@@ -92,7 +92,8 @@ test_gnunet_service_arm_SOURCES = \ | |||
92 | 92 | ||
93 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 93 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' |
94 | 94 | ||
95 | %.py: %.py.in Makefile | 95 | SUFFIXES = .py.in .py |
96 | .py.in.py: | ||
96 | $(do_subst) < $(srcdir)/$< > $@ | 97 | $(do_subst) < $(srcdir)/$< > $@ |
97 | chmod +x $@ | 98 | chmod +x $@ |
98 | 99 | ||
diff --git a/src/dht/Makefile.am b/src/dht/Makefile.am index 00ce0e934..4a78ea4c7 100644 --- a/src/dht/Makefile.am +++ b/src/dht/Makefile.am | |||
@@ -213,7 +213,8 @@ endif | |||
213 | 213 | ||
214 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' -e 's,[@]bindir[@],$(bindir),g' | 214 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' -e 's,[@]bindir[@],$(bindir),g' |
215 | 215 | ||
216 | %.py: %.py.in Makefile | 216 | SUFFIXES = .py.in .py |
217 | .py.in.py: | ||
217 | $(do_subst) < $(srcdir)/$< > $@ | 218 | $(do_subst) < $(srcdir)/$< > $@ |
218 | chmod +x $@ | 219 | chmod +x $@ |
219 | 220 | ||
diff --git a/src/include/gnunet_scheduler_lib.h b/src/include/gnunet_scheduler_lib.h index 875f5043a..a855ab8ab 100644 --- a/src/include/gnunet_scheduler_lib.h +++ b/src/include/gnunet_scheduler_lib.h | |||
@@ -400,6 +400,22 @@ void | |||
400 | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | 400 | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, |
401 | void *task_cls); | 401 | void *task_cls); |
402 | 402 | ||
403 | /** | ||
404 | * Initialize and run scheduler. This function will return when all | ||
405 | * tasks have completed. When @ install_signals is GNUNET_YES, then | ||
406 | * this function behaves in the same was as GNUNET_SCHEDULER_run does. | ||
407 | * If @ install_signals is GNUNET_NO then no signal handlers are | ||
408 | * installed. | ||
409 | * | ||
410 | * @param install_signals whether to install signals (GNUNET_YES/NO) | ||
411 | * @param task task to run first (and immediately) | ||
412 | * @param task_cls closure of @a task | ||
413 | */ | ||
414 | void | ||
415 | GNUNET_SCHEDULER_run_with_optional_signals (int install_signals, | ||
416 | GNUNET_SCHEDULER_TaskCallback task, | ||
417 | void *task_cls); | ||
418 | |||
403 | 419 | ||
404 | /** | 420 | /** |
405 | * Request the shutdown of a scheduler. Marks all tasks | 421 | * Request the shutdown of a scheduler. Marks all tasks |
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am index 6fff0b407..368980064 100644 --- a/src/integration-tests/Makefile.am +++ b/src/integration-tests/Makefile.am | |||
@@ -42,7 +42,8 @@ endif | |||
42 | 42 | ||
43 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 43 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' |
44 | 44 | ||
45 | %.py: %.py.in Makefile | 45 | SUFFIXES = .py.in .py |
46 | .py.in.py: | ||
46 | $(do_subst) < $(srcdir)/$< > $@ | 47 | $(do_subst) < $(srcdir)/$< > $@ |
47 | chmod +x $@ | 48 | chmod +x $@ |
48 | 49 | ||
diff --git a/src/statistics/Makefile.am b/src/statistics/Makefile.am index b2e256960..16a1ea2d0 100644 --- a/src/statistics/Makefile.am +++ b/src/statistics/Makefile.am | |||
@@ -90,7 +90,8 @@ endif | |||
90 | 90 | ||
91 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 91 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' |
92 | 92 | ||
93 | %.py: %.py.in Makefile | 93 | SUFFIXES = .py.in .py |
94 | .py.in.py: | ||
94 | $(do_subst) < $(srcdir)/$< > $@ | 95 | $(do_subst) < $(srcdir)/$< > $@ |
95 | chmod +x $@ | 96 | chmod +x $@ |
96 | 97 | ||
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index e9c25d68a..540a60557 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -787,6 +787,14 @@ void | |||
787 | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | 787 | GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, |
788 | void *task_cls) | 788 | void *task_cls) |
789 | { | 789 | { |
790 | GNUNET_SCHEDULER_run_with_optional_signals(GNUNET_YES, task, task_cls); | ||
791 | } | ||
792 | |||
793 | void | ||
794 | GNUNET_SCHEDULER_run_with_optional_signals (int install_signals, | ||
795 | GNUNET_SCHEDULER_TaskCallback task, | ||
796 | void *task_cls) | ||
797 | { | ||
790 | struct GNUNET_NETWORK_FDSet *rs; | 798 | struct GNUNET_NETWORK_FDSet *rs; |
791 | struct GNUNET_NETWORK_FDSet *ws; | 799 | struct GNUNET_NETWORK_FDSet *ws; |
792 | struct GNUNET_TIME_Relative timeout; | 800 | struct GNUNET_TIME_Relative timeout; |
@@ -820,24 +828,29 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | |||
820 | GNUNET_DISK_PIPE_END_READ); | 828 | GNUNET_DISK_PIPE_END_READ); |
821 | GNUNET_assert (NULL != pr); | 829 | GNUNET_assert (NULL != pr); |
822 | my_pid = getpid (); | 830 | my_pid = getpid (); |
823 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 831 | |
824 | "Registering signal handlers\n"); | 832 | if (GNUNET_YES == install_signals) |
825 | shc_int = GNUNET_SIGNAL_handler_install (SIGINT, | 833 | { |
834 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
835 | "Registering signal handlers\n"); | ||
836 | shc_int = GNUNET_SIGNAL_handler_install (SIGINT, | ||
837 | &sighandler_shutdown); | ||
838 | shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, | ||
826 | &sighandler_shutdown); | 839 | &sighandler_shutdown); |
827 | shc_term = GNUNET_SIGNAL_handler_install (SIGTERM, | ||
828 | &sighandler_shutdown); | ||
829 | #if (SIGTERM != GNUNET_TERM_SIG) | 840 | #if (SIGTERM != GNUNET_TERM_SIG) |
830 | shc_gterm = GNUNET_SIGNAL_handler_install (GNUNET_TERM_SIG, | 841 | shc_gterm = GNUNET_SIGNAL_handler_install (GNUNET_TERM_SIG, |
831 | &sighandler_shutdown); | 842 | &sighandler_shutdown); |
832 | #endif | 843 | #endif |
833 | #ifndef MINGW | 844 | #ifndef MINGW |
834 | shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE, | 845 | shc_pipe = GNUNET_SIGNAL_handler_install (SIGPIPE, |
835 | &sighandler_pipe); | 846 | &sighandler_pipe); |
836 | shc_quit = GNUNET_SIGNAL_handler_install (SIGQUIT, | 847 | shc_quit = GNUNET_SIGNAL_handler_install (SIGQUIT, |
837 | &sighandler_shutdown); | 848 | &sighandler_shutdown); |
838 | shc_hup = GNUNET_SIGNAL_handler_install (SIGHUP, | 849 | shc_hup = GNUNET_SIGNAL_handler_install (SIGHUP, |
839 | &sighandler_shutdown); | 850 | &sighandler_shutdown); |
840 | #endif | 851 | #endif |
852 | } | ||
853 | |||
841 | current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT; | 854 | current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT; |
842 | current_lifeness = GNUNET_YES; | 855 | current_lifeness = GNUNET_YES; |
843 | GNUNET_SCHEDULER_add_with_reason_and_priority (task, | 856 | GNUNET_SCHEDULER_add_with_reason_and_priority (task, |
@@ -953,16 +966,21 @@ GNUNET_SCHEDULER_run (GNUNET_SCHEDULER_TaskCallback task, | |||
953 | busy_wait_warning = 0; | 966 | busy_wait_warning = 0; |
954 | } | 967 | } |
955 | } | 968 | } |
956 | GNUNET_SIGNAL_handler_uninstall (shc_int); | 969 | |
957 | GNUNET_SIGNAL_handler_uninstall (shc_term); | 970 | if (GNUNET_YES == install_signals) |
971 | { | ||
972 | GNUNET_SIGNAL_handler_uninstall (shc_int); | ||
973 | GNUNET_SIGNAL_handler_uninstall (shc_term); | ||
958 | #if (SIGTERM != GNUNET_TERM_SIG) | 974 | #if (SIGTERM != GNUNET_TERM_SIG) |
959 | GNUNET_SIGNAL_handler_uninstall (shc_gterm); | 975 | GNUNET_SIGNAL_handler_uninstall (shc_gterm); |
960 | #endif | 976 | #endif |
961 | #ifndef MINGW | 977 | #ifndef MINGW |
962 | GNUNET_SIGNAL_handler_uninstall (shc_pipe); | 978 | GNUNET_SIGNAL_handler_uninstall (shc_pipe); |
963 | GNUNET_SIGNAL_handler_uninstall (shc_quit); | 979 | GNUNET_SIGNAL_handler_uninstall (shc_quit); |
964 | GNUNET_SIGNAL_handler_uninstall (shc_hup); | 980 | GNUNET_SIGNAL_handler_uninstall (shc_hup); |
965 | #endif | 981 | #endif |
982 | } | ||
983 | |||
966 | GNUNET_DISK_pipe_close (shutdown_pipe_handle); | 984 | GNUNET_DISK_pipe_close (shutdown_pipe_handle); |
967 | shutdown_pipe_handle = NULL; | 985 | shutdown_pipe_handle = NULL; |
968 | GNUNET_NETWORK_fdset_destroy (rs); | 986 | GNUNET_NETWORK_fdset_destroy (rs); |