+ /*
+ Add an idle handler that notifies a thread waiting for the
+ GLib event loop to run that the event loop is actually
+ running. We do this in the context of the event loop itself
+ to avoid race conditions.
+ */
+ GSource * const source = g_idle_source_new();
+ g_source_set_priority(source, G_PRIORITY_HIGH_IDLE);
+ g_source_set_callback(source,
+ CAPeripheralEventLoopStarted,
+ g_context.condition, // data
+ NULL); // notify
+ (void) g_source_attach(source, loop_context);
+ g_source_unref(source);