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

View File

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