Glib run loop adapter
Evan Schoenberg, M.D.
evan at adium.im
Thu May 13 17:13:55 UTC 2010
It came up during the meeting on Tuesday that a glib run loop adapter would be helpful for the ongoing vv efforts. Here is what we were using for msn-pecan integration:
/* Enable a glib run loop adapter */
static void glib_runloop_iterator(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) {
//Iterate on the glib loop a single time without blocking
g_main_context_iteration(/* context */ NULL, /* may_block */ FALSE);
}
void adium_purple_eventloop_enable_glib_runloop(void)
{
if (!g_thread_supported())
g_thread_init(NULL);
CFRunLoopObserverRef observer = CFRunLoopObserverCreate(kCFAllocatorDefault, kCFRunLoopBeforeSources,
/* repeats */ true, /* priority */ 0,
glib_runloop_iterator, NULL);
CFRunLoopAddObserver([[NSRunLoop currentRunLoop] getCFRunLoop], observer, kCFRunLoopDefaultMode);
CFRelease(observer);
}
-Evan
More information about the devel
mailing list