From 4db119c01b1c9a10a070a2b23a3d43ca2dc722c5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 3 Sep 2013 11:28:47 +0200 Subject: IOThread: use FatalError() on g_thread_create() error New GLib versions don't fail. --- src/IOThread.cxx | 10 +++++----- src/IOThread.hxx | 6 ++---- src/Main.cxx | 6 +----- test/dump_playlist.cxx | 6 +----- test/dump_text_file.cxx | 6 +----- test/read_tags.cxx | 6 +----- test/run_decoder.cxx | 6 +----- test/run_input.cxx | 6 +----- test/run_output.cxx | 6 +----- test/visit_archive.cxx | 6 +----- 10 files changed, 15 insertions(+), 49 deletions(-) diff --git a/src/IOThread.cxx b/src/IOThread.cxx index cba9c9263..f615b0491 100644 --- a/src/IOThread.cxx +++ b/src/IOThread.cxx @@ -23,6 +23,8 @@ #include "thread/Cond.hxx" #include "event/Loop.hxx" +#include + #include 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 diff --git a/src/IOThread.hxx b/src/IOThread.hxx index 8c6f233ab..cfa34a494 100644 --- a/src/IOThread.hxx +++ b/src/IOThread.hxx @@ -22,15 +22,13 @@ #include "gcc.h" -#include - 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 diff --git a/src/Main.cxx b/src/Main.cxx index 56f5b2c07..e724ebdb5 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -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); diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index f3339662c..768eee367 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -169,11 +169,7 @@ int main(int argc, char **argv) } io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); if (!input_stream_global_init(&error)) { g_warning("%s", error->message); diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index 8a8f9e77f..165a6493c 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -116,11 +116,7 @@ int main(int argc, char **argv) config_global_init(); io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); diff --git a/test/read_tags.cxx b/test/read_tags.cxx index 5880662de..d72721324 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -162,11 +162,7 @@ int main(int argc, char **argv) #endif io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); if (!input_stream_global_init(&error)) { g_warning("%s", error->message); diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index 85f7c4455..c7ef92cf8 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -163,11 +163,7 @@ int main(int argc, char **argv) g_log_set_default_handler(my_log_func, NULL); io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); if (!input_stream_global_init(&error)) { g_warning("%s", error->message); diff --git a/test/run_input.cxx b/test/run_input.cxx index cd7f299a6..494bcd823 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -134,11 +134,7 @@ int main(int argc, char **argv) config_global_init(); io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); diff --git a/test/run_output.cxx b/test/run_output.cxx index 59f962a4f..6bf4ebced 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -210,11 +210,7 @@ int main(int argc, char **argv) main_loop = new EventLoop(EventLoop::Default()); io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); /* initialize the audio output */ diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index d6ed0c6a1..047ef4d6d 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -77,11 +77,7 @@ main(int argc, char **argv) config_global_init(); io_thread_init(); - if (!io_thread_start(&error)) { - g_warning("%s", error->message); - g_error_free(error); - return EXIT_FAILURE; - } + io_thread_start(); archive_plugin_init_all(); -- cgit v1.2.3