[3091] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[PATCH 1/2] Make owl_select_post_task take a context argument

daemon@ATHENA.MIT.EDU (Adam Glasgall)
Sat May 28 20:48:48 2011

From: Adam Glasgall <glasgall@MIT.EDU>
To: barnowl-dev@mit.edu
Cc: Adam Glasgall <adam@crossproduct.net>
Date: Sat, 28 May 2011 20:47:54 -0400
In-Reply-To: <1306630076-31258-1-git-send-email-glasgall@mit.edu>

From: Adam Glasgall <adam@crossproduct.net>

Make owl_select_post_task take a context argument to indicate /which/ running mainloop it should run the task on, since now there's more than one.
---
 owl.c    |    3 ++-
 select.c |    8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/owl.c b/owl.c
index 302283e..45d72c9 100644
--- a/owl.c
+++ b/owl.c
@@ -382,7 +382,8 @@ static void sig_handler(const siginfo_t *siginfo, void *data) {
   }
   /* Send a message to the main thread. */
   owl_select_post_task(sig_handler_main_thread,
-                       GINT_TO_POINTER(siginfo->si_signo), NULL);
+                       GINT_TO_POINTER(siginfo->si_signo), 
+		       NULL, g_main_context_default());
 }
 
 #define CHECK_RESULT(s, syscall) \
diff --git a/select.c b/select.c
index 8dc6cd4..570b383 100644
--- a/select.c
+++ b/select.c
@@ -1,7 +1,7 @@
 #include "owl.h"
 
 static GMainLoop *loop = NULL;
-static GMainContext *context;
+static GMainContext *main_context;
 static int dispatch_active = 0;
 
 static GSource *owl_timer_source;
@@ -343,8 +343,8 @@ void owl_select_init(void)
 
 void owl_select_run_loop(void)
 {
-  context = g_main_context_default();
-  loop = g_main_loop_new(context, FALSE);
+  main_context = g_main_context_default();
+  loop = g_main_loop_new(main_context, FALSE);
   g_main_loop_run(loop);
 }
 
@@ -378,7 +378,7 @@ static void _destroy_task(void *data)
   g_free(t);
 }
 
-void owl_select_post_task(void (*cb)(void*), void *cbdata, void (*destroy_cbdata)(void*))
+void owl_select_post_task(void (*cb)(void*), void *cbdata, void (*destroy_cbdata)(void*), GMainContext *context)
 {
   GSource *source = g_idle_source_new();
   owl_task *t = g_new0(owl_task, 1);
-- 
1.7.2.3


home help back first fref pref prev next nref lref last post