Commit cd0e9287 authored by Max Kellermann's avatar Max Kellermann

test/DumpDatabase: start an EventThread

Our local EventLoop instance was never run; it was not usable.
parent 9033f077
...@@ -1766,6 +1766,7 @@ test_DumpDatabase_LDADD = \ ...@@ -1766,6 +1766,7 @@ test_DumpDatabase_LDADD = \
$(TAG_LIBS) \ $(TAG_LIBS) \
libconf.a \ libconf.a \
libevent.a \ libevent.a \
libthread.a \
$(FS_LIBS) \ $(FS_LIBS) \
libsystem.a \ libsystem.a \
$(ICU_LDADD) \ $(ICU_LDADD) \
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "config/Block.hxx" #include "config/Block.hxx"
#include "tag/Config.hxx" #include "tag/Config.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "event/Loop.hxx" #include "event/Thread.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
...@@ -44,14 +44,21 @@ using std::endl; ...@@ -44,14 +44,21 @@ using std::endl;
#include <stdlib.h> #include <stdlib.h>
class GlobalInit { class GlobalInit {
EventThread io_thread;
public: public:
GlobalInit() { GlobalInit() {
io_thread.Start();
config_global_init(); config_global_init();
} }
~GlobalInit() { ~GlobalInit() {
config_global_finish(); config_global_finish();
} }
EventLoop &GetEventLoop() {
return io_thread.GetEventLoop();
}
}; };
#ifdef ENABLE_UPNP #ifdef ENABLE_UPNP
...@@ -121,7 +128,6 @@ try { ...@@ -121,7 +128,6 @@ try {
TagLoadConfig(); TagLoadConfig();
EventLoop event_loop;
MyDatabaseListener database_listener; MyDatabaseListener database_listener;
/* do it */ /* do it */
...@@ -131,7 +137,8 @@ try { ...@@ -131,7 +137,8 @@ try {
if (path != nullptr) if (path != nullptr)
block.AddBlockParam("path", path->value.c_str(), path->line); 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; }; AtScopeExit(db) { delete db; };
......
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