- Timestamp:
- Mar 25, 2011, 3:46:46 AM (14 years ago)
- Children:
- 37d188f
- Parents:
- 96ade35
- git-author:
- David Benjamin <davidben@mit.edu> (02/26/11 14:11:26)
- git-committer:
- David Benjamin <davidben@mit.edu> (03/25/11 03:46:46)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
owl.c
rfafb842 r87833a8 354 354 } 355 355 356 static void sig_handler(int sig, void *data) { 356 static gboolean sig_handler_main_thread(gpointer data) { 357 int sig = GPOINTER_TO_INT(data); 358 357 359 owl_function_debugmsg("Got signal %d", sig); 358 360 /* TODO: These don't need to be re-entrant anymore! */ … … 372 374 owl_process_input_char(in); 373 375 } 376 return FALSE; 377 } 378 379 static void sig_handler(int sig, void *data) { 380 GMainContext *context = data; 381 GSource *source; 382 383 /* TODO: Special-case SIGINT so that it can interrupt outside the 384 * event loop. */ 385 386 /* Send a message to the main thread. */ 387 source = g_idle_source_new(); 388 g_source_set_priority(source, G_PRIORITY_DEFAULT); 389 g_source_set_callback(source, sig_handler_main_thread, 390 GINT_TO_POINTER(sig), NULL); 391 g_source_attach(source, context); 392 g_source_unref(source); 374 393 } 375 394 … … 385 404 sigaddset(&sigset, SIGINT); 386 405 387 owl_signal_init(&sigset, sig_handler, NULL);406 owl_signal_init(&sigset, sig_handler, g_main_context_default()); 388 407 } 389 408
Note: See TracChangeset
for help on using the changeset viewer.