summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
committerChristian Grothoff <christian@grothoff.org>2016-04-30 08:17:37 +0000
commit407940eab281ad623c1d5263d8aaf2d4032fa27d (patch)
treeec6a8dce09ea921df20cd25dbfe85e5c222f6696
parentb25fa8589635010a74304dbca9678a3ca5cdfd7d (diff)
downloadgnunet-gtk-407940eab281ad623c1d5263d8aaf2d4032fa27d.tar.gz
gnunet-gtk-407940eab281ad623c1d5263d8aaf2d4032fa27d.zip
implementing new scheduler shutdown semantics
-rw-r--r--src/conversation/gnunet-conversation-gtk.c5
-rw-r--r--src/conversation/gnunet-conversation-gtk_import.c4
-rw-r--r--src/fs/gnunet-fs-gtk.c8
-rw-r--r--src/identity/gnunet-identity-gtk.c3
-rw-r--r--src/lib/animations.c2
-rw-r--r--src/lib/eventloop.c14
-rw-r--r--src/main/gnunet-gtk.c3
-rw-r--r--src/namestore/gnunet-namestore-gtk.c3
-rw-r--r--src/peerinfo/gnunet-peerinfo-gtk.c3
-rw-r--r--src/setup/gnunet-setup-namestore-config.c2
-rw-r--r--src/setup/gnunet-setup.c3
-rw-r--r--src/statistics/gnunet-statistics-gtk.c7
12 files changed, 21 insertions, 36 deletions
diff --git a/src/conversation/gnunet-conversation-gtk.c b/src/conversation/gnunet-conversation-gtk.c
index 82b472a4..c091f7fb 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -191,9 +191,8 @@ run (void *cls,
191 gtk_widget_show (main_window); 191 gtk_widget_show (main_window);
192 gtk_window_present (GTK_WINDOW (main_window)); 192 gtk_window_present (GTK_WINDOW (main_window));
193 } 193 }
194 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 194 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
195 &shutdown_task, 195 NULL);
196 NULL);
197 if (NULL == ego_name) 196 if (NULL == ego_name)
198 ego_name = GNUNET_strdup ("master-zone"); 197 ego_name = GNUNET_strdup ("master-zone");
199 GCG_HISTORY_init (); 198 GCG_HISTORY_init ();
diff --git a/src/conversation/gnunet-conversation-gtk_import.c b/src/conversation/gnunet-conversation-gtk_import.c
index 8bc5050d..e8e1eede 100644
--- a/src/conversation/gnunet-conversation-gtk_import.c
+++ b/src/conversation/gnunet-conversation-gtk_import.c
@@ -317,11 +317,9 @@ GSC_add_phone (const gchar *label,
317 * Asynchronously disconnect from the namestore. 317 * Asynchronously disconnect from the namestore.
318 * 318 *
319 * @param cls closure (NULL) 319 * @param cls closure (NULL)
320 * @param tc scheduler context
321 */ 320 */
322static void 321static void
323async_disconnect (void *cls, 322async_disconnect (void *cls)
324 const struct GNUNET_SCHEDULER_TaskContext *tc)
325{ 323{
326 if (NULL != ns) 324 if (NULL != ns)
327 { 325 {
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 58db7609..d7266eac 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -337,10 +337,7 @@ GNUNET_FS_GTK_delete_event_cb (GtkWidget *object,
337 * just to be sure it is dead (if it isn't, application will hang up). 337 * just to be sure it is dead (if it isn't, application will hang up).
338 */ 338 */
339 GNUNET_SCHEDULER_shutdown (); 339 GNUNET_SCHEDULER_shutdown ();
340
341 GNUNET_GTK_tray_icon_destroy (); 340 GNUNET_GTK_tray_icon_destroy ();
342 GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
343 &shutdown_task, NULL);
344} 341}
345 342
346 343
@@ -842,10 +839,7 @@ run (void *cls)
842 argv[i]); 839 argv[i]);
843 } 840 }
844 } 841 }
845 842 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
846
847 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
848 &shutdown_task, NULL);
849} 843}
850 844
851 845
diff --git a/src/identity/gnunet-identity-gtk.c b/src/identity/gnunet-identity-gtk.c
index 3edb7bb4..62f6c171 100644
--- a/src/identity/gnunet-identity-gtk.c
+++ b/src/identity/gnunet-identity-gtk.c
@@ -534,8 +534,7 @@ run (void *cls)
534 identity = GNUNET_IDENTITY_connect (GIG_get_configuration (), 534 identity = GNUNET_IDENTITY_connect (GIG_get_configuration (),
535 &add_ego, 535 &add_ego,
536 NULL); 536 NULL);
537 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 537 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
538 &shutdown_task, NULL);
539} 538}
540 539
541 540
diff --git a/src/lib/animations.c b/src/lib/animations.c
index 16fa883d..ce030f70 100644
--- a/src/lib/animations.c
+++ b/src/lib/animations.c
@@ -121,7 +121,7 @@ static struct GNUNET_GTK_AnimationTreeViewHandle *atv_tail;
121/** 121/**
122 * Task run to update animations. 122 * Task run to update animations.
123 */ 123 */
124static struct GNUNET_SCHEDULER_Task * ticker_task; 124static struct GNUNET_SCHEDULER_Task *ticker_task;
125 125
126 126
127/** 127/**
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c
index 50b294f8..3e03a085 100644
--- a/src/lib/eventloop.c
+++ b/src/lib/eventloop.c
@@ -106,7 +106,7 @@ struct GNUNET_GTK_MainLoop
106 /** 106 /**
107 * Task we keep around just to keep the event loop running. 107 * Task we keep around just to keep the event loop running.
108 */ 108 */
109 struct GNUNET_SCHEDULER_Task * dummy_task; 109 struct GNUNET_SCHEDULER_Task *dummy_task;
110 110
111 /** 111 /**
112 * Remaining command-line arguments. 112 * Remaining command-line arguments.
@@ -359,9 +359,9 @@ keepalive_task (void *cls)
359 struct GNUNET_GTK_MainLoop *ml = cls; 359 struct GNUNET_GTK_MainLoop *ml = cls;
360 360
361 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dummy task was scheduled\n"); 361 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dummy task was scheduled\n");
362 ml->dummy_task = 362 ml->dummy_task
363 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 363 = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
364 &keepalive_task, ml); 364 &keepalive_task, ml);
365} 365}
366 366
367 367
@@ -912,7 +912,8 @@ run_main_loop (void *cls, char *const *args, const char *cfgfile,
912 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. bad command-line options, etc) 912 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error (i.e. bad command-line options, etc)
913 */ 913 */
914int 914int
915GNUNET_GTK_main_loop_start (const char *binary_name, const char *binary_help, 915GNUNET_GTK_main_loop_start (const char *binary_name,
916 const char *binary_help,
916 int argc, char *const *argv, 917 int argc, char *const *argv,
917 struct GNUNET_GETOPT_CommandLineOption *options, 918 struct GNUNET_GETOPT_CommandLineOption *options,
918 const char *main_window_file, 919 const char *main_window_file,
@@ -925,7 +926,8 @@ GNUNET_GTK_main_loop_start (const char *binary_name, const char *binary_help,
925 ml.main_window_file = main_window_file; 926 ml.main_window_file = main_window_file;
926 ml.main_task = main_task; 927 ml.main_task = main_task;
927 ret = 928 ret =
928 GNUNET_PROGRAM_run (argc, argv, binary_name, binary_help, options, 929 GNUNET_PROGRAM_run (argc, argv, binary_name,
930 binary_help, options,
929 &run_main_loop, &ml); 931 &run_main_loop, &ml);
930 if (NULL != ml.cached_poll_array) 932 if (NULL != ml.cached_poll_array)
931 g_free (ml.cached_poll_array); 933 g_free (ml.cached_poll_array);
diff --git a/src/main/gnunet-gtk.c b/src/main/gnunet-gtk.c
index 8d01a718..7837c75e 100644
--- a/src/main/gnunet-gtk.c
+++ b/src/main/gnunet-gtk.c
@@ -316,8 +316,7 @@ run (void *cls)
316 GNUNET_GTK_set_icon_search_path (); 316 GNUNET_GTK_set_icon_search_path ();
317 GNUNET_GTK_setup_nls (); 317 GNUNET_GTK_setup_nls ();
318 main_window = GTK_WIDGET (get_object ("gnunet_gtk_window")); 318 main_window = GTK_WIDGET (get_object ("gnunet_gtk_window"));
319 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 319 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
320 &cleanup_task, NULL);
321#ifdef GDK_WINDOWING_X11 320#ifdef GDK_WINDOWING_X11
322 plug ("gnunet_statistics_hbox", 321 plug ("gnunet_statistics_hbox",
323 "gnunet-statistics-gtk", 322 "gnunet-statistics-gtk",
diff --git a/src/namestore/gnunet-namestore-gtk.c b/src/namestore/gnunet-namestore-gtk.c
index 7f686086..750e1810 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -2823,8 +2823,7 @@ run (void *cls)
2823 NULL); 2823 NULL);
2824 gtk_widget_show (main_window); 2824 gtk_widget_show (main_window);
2825 gtk_window_present (GTK_WINDOW (main_window)); 2825 gtk_window_present (GTK_WINDOW (main_window));
2826 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 2826 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
2827 &cleanup_task, NULL);
2828} 2827}
2829 2828
2830 2829
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c b/src/peerinfo/gnunet-peerinfo-gtk.c
index c98a1839..f5a3f6f2 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -1678,8 +1678,7 @@ run (void *cts,
1678 gtk_widget_show (main_window); 1678 gtk_widget_show (main_window);
1679 gtk_window_present (GTK_WINDOW (main_window)); 1679 gtk_window_present (GTK_WINDOW (main_window));
1680 } 1680 }
1681 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 1681 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
1682 &shutdown_task, NULL);
1683} 1682}
1684 1683
1685 1684
diff --git a/src/setup/gnunet-setup-namestore-config.c b/src/setup/gnunet-setup-namestore-config.c
index d6cf756b..d03ca554 100644
--- a/src/setup/gnunet-setup-namestore-config.c
+++ b/src/setup/gnunet-setup-namestore-config.c
@@ -31,7 +31,7 @@
31 * Test if the configuration works for the given plugin. 31 * Test if the configuration works for the given plugin.
32 * 32 *
33 * @param name name of the plugin to check 33 * @param name name of the plugin to check
34 * @return GNUNET_OK on success, GNUNET_SYSERR if the config is wrong 34 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the config is wrong
35 */ 35 */
36static int 36static int
37test_config (const char *name) 37test_config (const char *name)
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c
index d70f5bf9..7ab9ca70 100644
--- a/src/setup/gnunet-setup.c
+++ b/src/setup/gnunet-setup.c
@@ -663,8 +663,7 @@ run (void *cls)
663 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 663 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
664 &start_identity, NULL); 664 &start_identity, NULL);
665 load_options (); 665 load_options ();
666 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 666 GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
667 &cleanup_task, NULL);
668 if (do_autoconfig) 667 if (do_autoconfig)
669 { 668 {
670 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 669 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
diff --git a/src/statistics/gnunet-statistics-gtk.c b/src/statistics/gnunet-statistics-gtk.c
index 57beed7f..0eef7e44 100644
--- a/src/statistics/gnunet-statistics-gtk.c
+++ b/src/statistics/gnunet-statistics-gtk.c
@@ -198,15 +198,13 @@ create_plot (const char *box_name, const struct PlotInfo *info)
198} 198}
199 199
200 200
201
202/** 201/**
203 * Task run on shutdown. 202 * Task run on shutdown.
204 * 203 *
205 * @param cls unused 204 * @param cls unused
206 * @param tc scheduler context, unused
207 */ 205 */
208static void 206static void
209shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 207shutdown_task (void *cls)
210{ 208{
211 GNUNET_GTK_tray_icon_destroy (); 209 GNUNET_GTK_tray_icon_destroy ();
212 GNUNET_GTK_main_loop_quit (ml); 210 GNUNET_GTK_main_loop_quit (ml);
@@ -280,8 +278,7 @@ run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
280 gtk_widget_show (main_window); 278 gtk_widget_show (main_window);
281 gtk_window_present (GTK_WINDOW (main_window)); 279 gtk_window_present (GTK_WINDOW (main_window));
282 } 280 }
283 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 281 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
284 &shutdown_task, NULL);
285} 282}
286 283
287 284