From 6f3d70b5e24cebbd6fd8c3a665a801628ef912ff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 27 Jan 2013 17:20:50 +0100 Subject: DecoderControl, InputStream: use Mutex/Cond instead of GMutex/GCond --- test/dump_playlist.cxx | 7 ++----- test/dump_text_file.cxx | 7 ++----- test/read_tags.cxx | 15 ++++++--------- test/run_decoder.cxx | 7 ++----- test/run_input.cxx | 7 ++----- 5 files changed, 14 insertions(+), 29 deletions(-) (limited to 'test') diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index b3cc8c26..175a407e 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -186,8 +186,8 @@ int main(int argc, char **argv) /* open the playlist */ - GMutex *mutex = g_mutex_new(); - GCond *cond = g_cond_new(); + Mutex mutex; + Cond cond; playlist = playlist_list_open_uri(uri, mutex, cond); if (playlist == NULL) { @@ -243,9 +243,6 @@ int main(int argc, char **argv) if (is != NULL) input_stream_close(is); - g_cond_free(cond); - g_mutex_free(mutex); - decoder_plugin_deinit_all(); playlist_list_global_finish(); input_stream_global_finish(); diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index dc3f9d6a..93b0d018 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -135,8 +135,8 @@ int main(int argc, char **argv) /* open the stream and dump it */ - GMutex *mutex = g_mutex_new(); - GCond *cond = g_cond_new(); + Mutex mutex; + Cond cond; is = input_stream_open(argv[1], mutex, cond, &error); if (is != NULL) { @@ -151,9 +151,6 @@ int main(int argc, char **argv) ret = 2; } - g_cond_free(cond); - g_mutex_free(mutex); - /* deinitialize everything */ input_stream_global_finish(); diff --git a/test/read_tags.cxx b/test/read_tags.cxx index a634d72b..ddd278ff 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -186,8 +186,8 @@ int main(int argc, char **argv) bool success = decoder_plugin_scan_file(plugin, path, &print_handler, NULL); if (!success && plugin->scan_stream != NULL) { - GMutex *mutex = g_mutex_new(); - GCond *cond = g_cond_new(); + Mutex mutex; + Cond cond; struct input_stream *is = input_stream_open(path, mutex, cond, &error); @@ -199,15 +199,15 @@ int main(int argc, char **argv) return 1; } - g_mutex_lock(mutex); + mutex.lock(); while (!is->ready) { - g_cond_wait(cond, mutex); + cond.wait(mutex); input_stream_update(is); } if (!input_stream_check(is, &error)) { - g_mutex_unlock(mutex); + mutex.unlock(); g_printerr("Failed to read %s: %s\n", path, error->message); @@ -216,14 +216,11 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - g_mutex_unlock(mutex); + mutex.unlock(); success = decoder_plugin_scan_stream(plugin, is, &print_handler, NULL); input_stream_close(is); - - g_cond_free(cond); - g_mutex_free(mutex); } decoder_plugin_deinit_all(); diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index b3e90844..288b83f9 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -188,8 +188,8 @@ int main(int argc, char **argv) decoder_plugin_file_decode(decoder.plugin, &decoder, decoder.uri); } else if (decoder.plugin->stream_decode != NULL) { - GMutex *mutex = g_mutex_new(); - GCond *cond = g_cond_new(); + Mutex mutex; + Cond cond; struct input_stream *is = input_stream_open(decoder.uri, mutex, cond, &error); @@ -206,9 +206,6 @@ int main(int argc, char **argv) decoder_plugin_stream_decode(decoder.plugin, &decoder, is); input_stream_close(is); - - g_cond_free(cond); - g_mutex_free(mutex); } else { g_printerr("Decoder plugin is not usable\n"); return 1; diff --git a/test/run_input.cxx b/test/run_input.cxx index b215eefe..db3e4dc8 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -149,8 +149,8 @@ int main(int argc, char **argv) /* open the stream and dump it */ - GMutex *mutex = g_mutex_new(); - GCond *cond = g_cond_new(); + Mutex mutex; + Cond cond; is = input_stream_open(argv[1], mutex, cond, &error); if (is != NULL) { @@ -165,9 +165,6 @@ int main(int argc, char **argv) ret = 2; } - g_cond_free(cond); - g_mutex_free(mutex); - /* deinitialize everything */ input_stream_global_finish(); -- cgit v1.2.3