aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/io_thread.c10
-rw-r--r--src/io_thread.h8
2 files changed, 16 insertions, 2 deletions
diff --git a/src/io_thread.c b/src/io_thread.c
index a2249ae95..4677428d6 100644
--- a/src/io_thread.c
+++ b/src/io_thread.c
@@ -31,13 +31,19 @@ static struct {
GThread *thread;
} io;
-static gpointer
-io_thread_func(G_GNUC_UNUSED gpointer arg)
+void
+io_thread_run(void)
{
assert(io.context != NULL);
assert(io.loop != NULL);
g_main_loop_run(io.loop);
+}
+
+static gpointer
+io_thread_func(G_GNUC_UNUSED gpointer arg)
+{
+ io_thread_run();
return NULL;
}
diff --git a/src/io_thread.h b/src/io_thread.h
index 2daddba86..5687aebb9 100644
--- a/src/io_thread.h
+++ b/src/io_thread.h
@@ -29,6 +29,14 @@ io_thread_init(void);
bool
io_thread_start(GError **error_r);
+/**
+ * Run the I/O event loop synchronously in the current thread. This
+ * can be called instead of io_thread_start(). For testing purposes
+ * only.
+ */
+void
+io_thread_run(void);
+
void
io_thread_deinit(void);