test/DumpDatabase: start an EventThread
Our local EventLoop instance was never run; it was not usable.
This commit is contained in:
parent
9033f07724
commit
cd0e92878f
@ -1766,6 +1766,7 @@ test_DumpDatabase_LDADD = \
|
||||
$(TAG_LIBS) \
|
||||
libconf.a \
|
||||
libevent.a \
|
||||
libthread.a \
|
||||
$(FS_LIBS) \
|
||||
libsystem.a \
|
||||
$(ICU_LDADD) \
|
||||
|
@ -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 <stdlib.h>
|
||||
|
||||
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; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user