diff options
author | Max Kellermann <max@musicpd.org> | 2017-02-10 22:14:07 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-02-10 22:25:01 +0100 |
commit | d1456ae039465dce44516624c1d44ee02b9f7613 (patch) | |
tree | ace78ac87758adb027ce86ee83029aa9cbaa190a /test | |
parent | 115af4f5650f0c48a16765184050b509be7876b0 (diff) |
test/*: use class EventThread instead of ScopeIOThread
Diffstat (limited to 'test')
-rw-r--r-- | test/ScopeIOThread.hxx | 36 | ||||
-rw-r--r-- | test/dump_playlist.cxx | 7 | ||||
-rw-r--r-- | test/dump_text_file.cxx | 7 | ||||
-rw-r--r-- | test/read_tags.cxx | 7 | ||||
-rw-r--r-- | test/run_decoder.cxx | 7 | ||||
-rw-r--r-- | test/run_input.cxx | 7 | ||||
-rw-r--r-- | test/run_output.cxx | 11 | ||||
-rw-r--r-- | test/run_storage.cxx | 12 | ||||
-rw-r--r-- | test/visit_archive.cxx | 7 |
9 files changed, 36 insertions, 65 deletions
diff --git a/test/ScopeIOThread.hxx b/test/ScopeIOThread.hxx deleted file mode 100644 index 782209d4f..000000000 --- a/test/ScopeIOThread.hxx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2003-2017 The Music Player Daemon Project - * http://www.musicpd.org - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef MPD_SCOPE_IO_THREAD_HXX -#define MPD_SCOPE_IO_THREAD_HXX - -#include "IOThread.hxx" - -struct ScopeIOThread { - ScopeIOThread() { - io_thread_init(); - io_thread_start(); - } - - ~ScopeIOThread() { - io_thread_deinit(); - } -}; - -#endif diff --git a/test/dump_playlist.cxx b/test/dump_playlist.cxx index a33c392a2..3cb75a5c9 100644 --- a/test/dump_playlist.cxx +++ b/test/dump_playlist.cxx @@ -25,7 +25,7 @@ #include "config/ConfigGlobal.hxx" #include "decoder/DecoderList.hxx" #include "input/Init.hxx" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "playlist/PlaylistRegistry.hxx" #include "playlist/PlaylistPlugin.hxx" #include "fs/Path.hxx" @@ -64,9 +64,10 @@ try { ReadConfigFile(config_path); - const ScopeIOThread io_thread; + EventThread io_thread; + io_thread.Start(); - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); playlist_list_global_init(); decoder_plugin_init_all(); diff --git a/test/dump_text_file.cxx b/test/dump_text_file.cxx index c88b04050..c72d60464 100644 --- a/test/dump_text_file.cxx +++ b/test/dump_text_file.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "input/Init.hxx" #include "input/InputStream.hxx" #include "input/TextInputStream.hxx" @@ -37,15 +37,16 @@ #include <stdlib.h> class GlobalInit { - const ScopeIOThread io_thread; + EventThread io_thread; public: GlobalInit() { + io_thread.Start(); config_global_init(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); #endif - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); } ~GlobalInit() { diff --git a/test/read_tags.cxx b/test/read_tags.cxx index 7534f661e..8bc33b804 100644 --- a/test/read_tags.cxx +++ b/test/read_tags.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "decoder/DecoderList.hxx" #include "decoder/DecoderPlugin.hxx" #include "input/Init.hxx" @@ -86,9 +86,10 @@ try { decoder_name = argv[1]; const Path path = Path::FromFS(argv[2]); - const ScopeIOThread io_thread; + EventThread io_thread; + io_thread.Start(); - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); AtScopeExit() { input_stream_global_finish(); }; decoder_plugin_init_all(); diff --git a/test/run_decoder.cxx b/test/run_decoder.cxx index 7760d008c..5bc00199c 100644 --- a/test/run_decoder.cxx +++ b/test/run_decoder.cxx @@ -18,7 +18,7 @@ */ #include "config.h" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "decoder/DecoderList.hxx" #include "decoder/DecoderPlugin.hxx" #include "FakeDecoderAPI.hxx" @@ -46,9 +46,10 @@ try { const char *const decoder_name = argv[1]; const char *const uri = argv[2]; - const ScopeIOThread io_thread; + EventThread io_thread; + io_thread.Start(); - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); decoder_plugin_init_all(); diff --git a/test/run_input.cxx b/test/run_input.cxx index 125e909c6..d7bf58824 100644 --- a/test/run_input.cxx +++ b/test/run_input.cxx @@ -23,7 +23,7 @@ #include "config/ConfigGlobal.hxx" #include "input/InputStream.hxx" #include "input/Init.hxx" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "thread/Cond.hxx" #include "Log.hxx" #include "fs/io/BufferedOutputStream.hxx" @@ -39,15 +39,16 @@ #include <stdlib.h> class GlobalInit { - const ScopeIOThread io_thread; + EventThread io_thread; public: GlobalInit() { + io_thread.Start(); config_global_init(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); #endif - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); } ~GlobalInit() { diff --git a/test/run_output.cxx b/test/run_output.cxx index 37954378b..a4a39b826 100644 --- a/test/run_output.cxx +++ b/test/run_output.cxx @@ -26,8 +26,7 @@ #include "config/ConfigOption.hxx" #include "Idle.hxx" #include "Main.hxx" -#include "event/Loop.hxx" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "fs/Path.hxx" #include "AudioParser.hxx" #include "ReplayGainConfig.hxx" @@ -136,14 +135,14 @@ try { config_global_init(); ReadConfigFile(config_path); - EventLoop event_loop; - - const ScopeIOThread io_thread; + EventThread io_thread; + io_thread.Start(); /* initialize the audio output */ DummyAudioOutputClient client; - AudioOutput *ao = load_audio_output(event_loop, client, argv[2]); + AudioOutput *ao = load_audio_output(io_thread.GetEventLoop(), client, + argv[2]); /* parse the audio format */ diff --git a/test/run_storage.cxx b/test/run_storage.cxx index 805211fe0..3d33772ea 100644 --- a/test/run_storage.cxx +++ b/test/run_storage.cxx @@ -19,7 +19,7 @@ #include "config.h" #include "Log.hxx" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "storage/Registry.hxx" #include "storage/StorageInterface.hxx" #include "storage/FileInfo.hxx" @@ -34,9 +34,9 @@ #include <time.h> static Storage * -MakeStorage(const char *uri) +MakeStorage(EventLoop &event_loop, const char *uri) { - Storage *storage = CreateStorageURI(io_thread_get(), uri); + Storage *storage = CreateStorageURI(event_loop, uri); if (storage == nullptr) throw std::runtime_error("Unrecognized storage URI"); @@ -95,7 +95,8 @@ try { const char *const command = argv[1]; const char *const storage_uri = argv[2]; - const ScopeIOThread io_thread; + EventThread io_thread; + io_thread.Start(); if (strcmp(command, "ls") == 0) { if (argc != 4) { @@ -105,7 +106,8 @@ try { const char *const path = argv[3]; - std::unique_ptr<Storage> storage(MakeStorage(storage_uri)); + std::unique_ptr<Storage> storage(MakeStorage(io_thread.GetEventLoop(), + storage_uri)); return Ls(*storage, path); } else { diff --git a/test/visit_archive.cxx b/test/visit_archive.cxx index c0668290a..c16d8e5e9 100644 --- a/test/visit_archive.cxx +++ b/test/visit_archive.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "tag/Tag.hxx" #include "config/ConfigGlobal.hxx" -#include "ScopeIOThread.hxx" +#include "event/Thread.hxx" #include "input/Init.hxx" #include "archive/ArchiveList.hxx" #include "archive/ArchivePlugin.hxx" @@ -36,15 +36,16 @@ #include <stdio.h> class GlobalInit { - const ScopeIOThread io_thread; + EventThread io_thread; public: GlobalInit() { + io_thread.Start(); config_global_init(); #ifdef ENABLE_ARCHIVE archive_plugin_init_all(); #endif - input_stream_global_init(io_thread_get()); + input_stream_global_init(io_thread.GetEventLoop()); } ~GlobalInit() { |