io_thread: add function io_thread_run()

This commit is contained in:
Max Kellermann 2011-08-29 09:51:59 +02:00
parent 453368078b
commit 4a75acb46c
2 changed files with 16 additions and 2 deletions

View File

@ -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;
}

View File

@ -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);