io_thread: add function io_thread_quit()
This commit is contained in:
parent
a97ddc8cb9
commit
4733c5fef0
@ -74,13 +74,20 @@ io_thread_start(GError **error_r)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
io_thread_quit(void)
|
||||||
|
{
|
||||||
|
assert(io.loop != NULL);
|
||||||
|
|
||||||
|
g_main_loop_quit(io.loop);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
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);
|
|||||||
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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user