diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-30 22:08:26 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-30 22:08:26 +0100 |
commit | bb88e80675820e01e17028b061eb11ae7a63d55c (patch) | |
tree | bf6647077c195a91fbc3ead976f97d4e33fb96bc /src/worker.c | |
parent | 262da2492d77f2a6feab3a99a725dbddf6d16188 (diff) | |
download | biruda-bb88e80675820e01e17028b061eb11ae7a63d55c.tar.gz biruda-bb88e80675820e01e17028b061eb11ae7a63d55c.tar.bz2 |
playing with glib main loop and events
Diffstat (limited to 'src/worker.c')
-rw-r--r-- | src/worker.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/worker.c b/src/worker.c index 9fec49b..6cfa1bb 100644 --- a/src/worker.c +++ b/src/worker.c @@ -86,7 +86,21 @@ int worker_init( worker_t *worker ) return -1; } + GMainContext *context = g_main_context_default( ); + GMainLoop *main_loop = g_main_loop_new( context, TRUE ); + g_child_watch_add( wed->pid, (GChildWatchFunc)watch_child, (gpointer *)wed ); + + // TODO: first one blocks (of course).. + //~ g_main_loop_run( main_loop ); + + // .. second one should go into the coordinator loop + // (and should not leak the glib-based implementation + // to the coordinator) + //~ for( ;; ) { + //~ gboolean res = g_main_context_iteration( context, FALSE ); + //~ sleep( 1 ); + //~ } worker->state = WORKER_STATE_RUNNING; |