+ /* set up idle source to signal when the main loop is running and
+ * it's safe for ::stop() to call g_main_loop_quit() */
+ source = g_idle_source_new ();
+ g_source_set_callback (source, thread_ready_idle_cb, sink, NULL);
+ g_source_attach (source, souphttpsink->context);
+ g_source_unref (source);
+
+ souphttpsink->loop = g_main_loop_new (souphttpsink->context, TRUE);
+
+ g_mutex_lock (souphttpsink->mutex);
+
+ /* FIXME: error handling */
+#if !GLIB_CHECK_VERSION (2, 31, 0)