IOThread: use FatalError() on g_thread_create() error

New GLib versions don't fail.
This commit is contained in:
Max Kellermann
2013-09-03 11:28:47 +02:00
parent bbd7115564
commit 4db119c01b
10 changed files with 15 additions and 49 deletions

View File

@@ -23,6 +23,8 @@
#include "thread/Cond.hxx"
#include "event/Loop.hxx"
#include <glib.h>
#include <assert.h>
static struct {
@@ -63,8 +65,8 @@ io_thread_init(void)
io.loop = new EventLoop();
}
bool
io_thread_start(gcc_unused GError **error_r)
void
io_thread_start()
{
assert(io.loop != NULL);
assert(io.thread == NULL);
@@ -76,10 +78,8 @@ io_thread_start(gcc_unused GError **error_r)
#else
io.thread = g_thread_create(io_thread_func, NULL, true, error_r);
if (io.thread == NULL)
return false;
FatalError();
#endif
return true;
}
void

View File

@@ -22,15 +22,13 @@
#include "gcc.h"
#include <glib.h>
class EventLoop;
void
io_thread_init(void);
bool
io_thread_start(GError **error_r);
void
io_thread_start();
/**
* Run the I/O event loop synchronously in the current thread. This

View File

@@ -480,11 +480,7 @@ int mpd_main(int argc, char *argv[])
SignalHandlersInit(*main_loop);
if (!io_thread_start(&error)) {
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
io_thread_start();
ZeroconfInit(*main_loop);