aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/io_thread.c11
-rw-r--r--src/io_thread.h8
2 files changed, 17 insertions, 2 deletions
diff --git a/src/io_thread.c b/src/io_thread.c
index 4677428d6..a0e3a8844 100644
--- a/src/io_thread.c
+++ b/src/io_thread.c
@@ -75,12 +75,19 @@ io_thread_start(GError **error_r)
}
void
+io_thread_quit(void)
+{
+ assert(io.loop != NULL);
+
+ g_main_loop_quit(io.loop);
+}
+
+void
io_thread_deinit(void)
{
if (io.thread != NULL) {
- assert(io.loop != NULL);
+ io_thread_quit();
- g_main_loop_quit(io.loop);
g_thread_join(io.thread);
}
diff --git a/src/io_thread.h b/src/io_thread.h
index 5687aebb9..db925ab8f 100644
--- a/src/io_thread.h
+++ b/src/io_thread.h
@@ -37,6 +37,14 @@ io_thread_start(GError **error_r);
void
io_thread_run(void);
+/**
+ * Ask the I/O thread to quit, but does not wait for it. Usually, you
+ * don't need to call this function, because io_thread_deinit()
+ * includes this.
+ */
+void
+io_thread_quit(void);
+
void
io_thread_deinit(void);