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) \
|
$(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 @@
|
|||||||
#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;
|
|||||||
#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 {
|
|||||||
|
|
||||||
TagLoadConfig();
|
TagLoadConfig();
|
||||||
|
|
||||||
EventLoop event_loop;
|
|
||||||
MyDatabaseListener database_listener;
|
MyDatabaseListener database_listener;
|
||||||
|
|
||||||
/* do it */
|
/* do it */
|
||||||
@ -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; };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user