diff --git a/Makefile.am b/Makefile.am index 3363e337f..42ba6eefc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1766,6 +1766,7 @@ test_DumpDatabase_LDADD = \ $(TAG_LIBS) \ libconf.a \ libevent.a \ + libthread.a \ $(FS_LIBS) \ libsystem.a \ $(ICU_LDADD) \ diff --git a/test/DumpDatabase.cxx b/test/DumpDatabase.cxx index c1d289a1c..f3af8843c 100644 --- a/test/DumpDatabase.cxx +++ b/test/DumpDatabase.cxx @@ -31,7 +31,7 @@ #include "config/Block.hxx" #include "tag/Config.hxx" #include "fs/Path.hxx" -#include "event/Loop.hxx" +#include "event/Thread.hxx" #include "Log.hxx" #include "util/ScopeExit.hxx" @@ -44,14 +44,21 @@ using std::endl; #include class GlobalInit { + EventThread io_thread; + public: GlobalInit() { + io_thread.Start(); config_global_init(); } ~GlobalInit() { config_global_finish(); } + + EventLoop &GetEventLoop() { + return io_thread.GetEventLoop(); + } }; #ifdef ENABLE_UPNP @@ -121,7 +128,6 @@ try { TagLoadConfig(); - EventLoop event_loop; MyDatabaseListener database_listener; /* do it */ @@ -131,7 +137,8 @@ try { if (path != nullptr) block.AddBlockParam("path", path->value.c_str(), path->line); - Database *db = plugin->create(event_loop, database_listener, block); + Database *db = plugin->create(init.GetEventLoop(), + database_listener, block); AtScopeExit(db) { delete db; };