Commit 4733c5fe authored by Max Kellermann's avatar Max Kellermann

io_thread: add function io_thread_quit()

parent a97ddc8c
...@@ -75,12 +75,19 @@ io_thread_start(GError **error_r) ...@@ -75,12 +75,19 @@ io_thread_start(GError **error_r)
} }
void void
io_thread_quit(void)
{
assert(io.loop != NULL);
g_main_loop_quit(io.loop);
}
void
io_thread_deinit(void) io_thread_deinit(void)
{ {
if (io.thread != NULL) { if (io.thread != NULL) {
assert(io.loop != NULL); io_thread_quit();
g_main_loop_quit(io.loop);
g_thread_join(io.thread); g_thread_join(io.thread);
} }
......
...@@ -37,6 +37,14 @@ io_thread_start(GError **error_r); ...@@ -37,6 +37,14 @@ io_thread_start(GError **error_r);
void void
io_thread_run(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 void
io_thread_deinit(void); io_thread_deinit(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment