io_thread: add function io_thread_run()
This commit is contained in:
@@ -31,13 +31,19 @@ static struct {
|
|||||||
GThread *thread;
|
GThread *thread;
|
||||||
} io;
|
} io;
|
||||||
|
|
||||||
static gpointer
|
void
|
||||||
io_thread_func(G_GNUC_UNUSED gpointer arg)
|
io_thread_run(void)
|
||||||
{
|
{
|
||||||
assert(io.context != NULL);
|
assert(io.context != NULL);
|
||||||
assert(io.loop != NULL);
|
assert(io.loop != NULL);
|
||||||
|
|
||||||
g_main_loop_run(io.loop);
|
g_main_loop_run(io.loop);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gpointer
|
||||||
|
io_thread_func(G_GNUC_UNUSED gpointer arg)
|
||||||
|
{
|
||||||
|
io_thread_run();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -29,6 +29,14 @@ io_thread_init(void);
|
|||||||
bool
|
bool
|
||||||
io_thread_start(GError **error_r);
|
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
|
void
|
||||||
io_thread_deinit(void);
|
io_thread_deinit(void);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user