aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-27 17:20:50 +0100
committerMax Kellermann <max@duempel.org>2013-01-27 18:39:32 +0100
commit6f3d70b5e24cebbd6fd8c3a665a801628ef912ff (patch)
tree88ab67b76bac4b88422c3debe7c46d6168a71934 /test
parent257a0dee758049586efbf0dc3f0339b0cef03456 (diff)
DecoderControl, InputStream: use Mutex/Cond instead of GMutex/GCond
Diffstat (limited to 'test')
-rw-r--r--test/dump_playlist.cxx7
-rw-r--r--test/dump_text_file.cxx7
-rw-r--r--test/read_tags.cxx15
-rw-r--r--test/run_decoder.cxx7
-rw-r--r--test/run_input.cxx7
5 files changed, 14 insertions, 29 deletions
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();