Commit d1456ae0 authored by Max Kellermann's avatar Max Kellermann

test/*: use class EventThread instead of ScopeIOThread

parent 115af4f5
......@@ -1786,8 +1786,6 @@ test_run_storage_LDADD = \
libutil.a
test_run_storage_SOURCES = \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
test/ScopeIOThread.hxx \
test/run_storage.cxx
if ENABLE_WEBDAV
......@@ -1808,16 +1806,13 @@ test_run_input_LDADD = \
libsystem.a \
libutil.a
test_run_input_SOURCES = test/run_input.cxx \
test/ScopeIOThread.hxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/TagSave.cxx
if ENABLE_NEIGHBOR_PLUGINS
test_run_neighbor_explorer_SOURCES = \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
test/run_neighbor_explorer.cxx
test_run_neighbor_explorer_LDADD = $(AM_LDADD) \
$(NEIGHBOR_LIBS) \
......@@ -1852,9 +1847,7 @@ test_visit_archive_LDADD = \
libsystem.a \
libutil.a
test_visit_archive_SOURCES = test/visit_archive.cxx \
test/ScopeIOThread.hxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/input/Open.cxx
endif
......@@ -1900,9 +1893,7 @@ test_dump_text_file_LDADD = \
libthread.a \
libutil.a
test_dump_text_file_SOURCES = test/dump_text_file.cxx \
test/ScopeIOThread.hxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx
src/Log.cxx src/LogBackend.cxx
test_dump_playlist_LDADD = \
$(PLAYLIST_LIBS) \
......@@ -1923,9 +1914,7 @@ test_dump_playlist_LDADD = \
libpcm.a
test_dump_playlist_SOURCES = test/dump_playlist.cxx \
test/FakeDecoderAPI.cxx test/FakeDecoderAPI.hxx \
test/ScopeIOThread.hxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/TagSave.cxx \
src/TagFile.cxx \
src/DetachedSong.cxx
......@@ -1952,10 +1941,8 @@ test_run_decoder_LDADD = \
libutil.a
test_run_decoder_SOURCES = test/run_decoder.cxx \
test/FakeDecoderAPI.cxx test/FakeDecoderAPI.hxx \
test/ScopeIOThread.hxx \
src/DetachedSong.cxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/ReplayGainInfo.cxx
test_read_tags_LDADD = \
......@@ -1974,10 +1961,8 @@ test_read_tags_LDADD = \
libutil.a
test_read_tags_SOURCES = test/read_tags.cxx \
test/FakeDecoderAPI.cxx test/FakeDecoderAPI.hxx \
test/ScopeIOThread.hxx \
src/DetachedSong.cxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/ReplayGainInfo.cxx
test_ReadApeTags_LDADD = \
......@@ -2130,9 +2115,7 @@ test_run_output_LDADD = $(MPD_LIBS) \
libthread.a \
libutil.a
test_run_output_SOURCES = test/run_output.cxx \
test/ScopeIOThread.hxx \
src/Log.cxx src/LogBackend.cxx \
src/IOThread.cxx \
src/output/Domain.cxx \
src/output/Init.cxx src/output/Finish.cxx src/output/Registry.cxx \
src/output/OutputPlugin.cxx \
......
/*
* 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
......@@ -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();
......
......@@ -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() {
......
......@@ -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();
......
......@@ -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();
......
......@@ -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() {
......
......@@ -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 */
......
......@@ -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 {
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment