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

View File

@ -22,15 +22,13 @@
#include "gcc.h" #include "gcc.h"
#include <glib.h>
class EventLoop; class EventLoop;
void void
io_thread_init(void); io_thread_init(void);
bool void
io_thread_start(GError **error_r); io_thread_start();
/** /**
* Run the I/O event loop synchronously in the current thread. This * 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); SignalHandlersInit(*main_loop);
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
ZeroconfInit(*main_loop); ZeroconfInit(*main_loop);

View File

@ -169,11 +169,7 @@ int main(int argc, char **argv)
} }
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
if (!input_stream_global_init(&error)) { if (!input_stream_global_init(&error)) {
g_warning("%s", error->message); g_warning("%s", error->message);

View File

@ -116,11 +116,7 @@ int main(int argc, char **argv)
config_global_init(); config_global_init();
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
#ifdef ENABLE_ARCHIVE #ifdef ENABLE_ARCHIVE
archive_plugin_init_all(); archive_plugin_init_all();

View File

@ -162,11 +162,7 @@ int main(int argc, char **argv)
#endif #endif
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
if (!input_stream_global_init(&error)) { if (!input_stream_global_init(&error)) {
g_warning("%s", error->message); g_warning("%s", error->message);

View File

@ -163,11 +163,7 @@ int main(int argc, char **argv)
g_log_set_default_handler(my_log_func, NULL); g_log_set_default_handler(my_log_func, NULL);
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
if (!input_stream_global_init(&error)) { if (!input_stream_global_init(&error)) {
g_warning("%s", error->message); g_warning("%s", error->message);

View File

@ -134,11 +134,7 @@ int main(int argc, char **argv)
config_global_init(); config_global_init();
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
#ifdef ENABLE_ARCHIVE #ifdef ENABLE_ARCHIVE
archive_plugin_init_all(); archive_plugin_init_all();

View File

@ -210,11 +210,7 @@ int main(int argc, char **argv)
main_loop = new EventLoop(EventLoop::Default()); main_loop = new EventLoop(EventLoop::Default());
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
/* initialize the audio output */ /* initialize the audio output */

View File

@ -77,11 +77,7 @@ main(int argc, char **argv)
config_global_init(); config_global_init();
io_thread_init(); io_thread_init();
if (!io_thread_start(&error)) { io_thread_start();
g_warning("%s", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
archive_plugin_init_all(); archive_plugin_init_all();