Revert "event/Thread: start the thread in the constructor"
This reverts commit b49cfe96f4
. It was
a bad idea because it broke signal handlers. I need to find a better
way to fix io_uring intialization.
This commit is contained in:
@ -329,6 +329,9 @@ MainConfigured(const CommandLineOptions &options,
|
|||||||
Instance instance;
|
Instance instance;
|
||||||
global_instance = &instance;
|
global_instance = &instance;
|
||||||
|
|
||||||
|
instance.io_thread.Start();
|
||||||
|
instance.rtio_thread.Start();
|
||||||
|
|
||||||
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
#ifdef ENABLE_NEIGHBOR_PLUGINS
|
||||||
instance.neighbors = std::make_unique<NeighborGlue>();
|
instance.neighbors = std::make_unique<NeighborGlue>();
|
||||||
instance.neighbors->Init(raw_config,
|
instance.neighbors->Init(raw_config,
|
||||||
|
@ -20,9 +20,7 @@ class EventThread final {
|
|||||||
public:
|
public:
|
||||||
explicit EventThread(bool _realtime=false)
|
explicit EventThread(bool _realtime=false)
|
||||||
:event_loop(ThreadId::Null()), thread(BIND_THIS_METHOD(Run)),
|
:event_loop(ThreadId::Null()), thread(BIND_THIS_METHOD(Run)),
|
||||||
realtime(_realtime) {
|
realtime(_realtime) {}
|
||||||
Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
~EventThread() noexcept {
|
~EventThread() noexcept {
|
||||||
Stop();
|
Stop();
|
||||||
@ -32,11 +30,11 @@ public:
|
|||||||
return event_loop;
|
return event_loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
void Stop() noexcept;
|
void Stop() noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
void Run() noexcept;
|
void Run() noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,6 +28,12 @@ class GlobalInit {
|
|||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
GlobalInit() {
|
||||||
|
io_thread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
~GlobalInit() = default;
|
||||||
|
|
||||||
EventLoop &GetEventLoop() {
|
EventLoop &GetEventLoop() {
|
||||||
return io_thread.GetEventLoop();
|
return io_thread.GetEventLoop();
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ try {
|
|||||||
const char *path = argv[1];
|
const char *path = argv[1];
|
||||||
|
|
||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
|
io_thread.Start();
|
||||||
|
|
||||||
const ScopeInputPluginsInit input_plugins_init(ConfigData(),
|
const ScopeInputPluginsInit input_plugins_init(ConfigData(),
|
||||||
io_thread.GetEventLoop());
|
io_thread.GetEventLoop());
|
||||||
|
@ -84,6 +84,8 @@ public:
|
|||||||
input_plugins_init(config, io_thread.GetEventLoop()),
|
input_plugins_init(config, io_thread.GetEventLoop()),
|
||||||
decoder_plugins_init(config)
|
decoder_plugins_init(config)
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
|
|
||||||
pcm_convert_global_init(config);
|
pcm_convert_global_init(config);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -47,6 +47,7 @@ try {
|
|||||||
const auto config = AutoLoadConfigFile(config_path);
|
const auto config = AutoLoadConfigFile(config_path);
|
||||||
|
|
||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
|
io_thread.Start();
|
||||||
|
|
||||||
const ScopeInputPluginsInit input_plugins_init(config, io_thread.GetEventLoop());
|
const ScopeInputPluginsInit input_plugins_init(config, io_thread.GetEventLoop());
|
||||||
const ScopePlaylistPluginsInit playlist_plugins_init(config);
|
const ScopePlaylistPluginsInit playlist_plugins_init(config);
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
explicit GlobalInit(Path config_path)
|
explicit GlobalInit(Path config_path)
|
||||||
:config(AutoLoadConfigFile(config_path))
|
:config(AutoLoadConfigFile(config_path))
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ try {
|
|||||||
const char *path = argv[2];
|
const char *path = argv[2];
|
||||||
|
|
||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
|
io_thread.Start();
|
||||||
|
|
||||||
const ScopeInputPluginsInit input_plugins_init(ConfigData(),
|
const ScopeInputPluginsInit input_plugins_init(ConfigData(),
|
||||||
io_thread.GetEventLoop());
|
io_thread.GetEventLoop());
|
||||||
|
@ -91,6 +91,7 @@ public:
|
|||||||
input_plugins_init(config, io_thread.GetEventLoop()),
|
input_plugins_init(config, io_thread.GetEventLoop()),
|
||||||
decoder_plugins_init(config)
|
decoder_plugins_init(config)
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +130,7 @@ public:
|
|||||||
explicit GlobalInit(Path config_path)
|
explicit GlobalInit(Path config_path)
|
||||||
:config(AutoLoadConfigFile(config_path))
|
:config(AutoLoadConfigFile(config_path))
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,6 +158,7 @@ try {
|
|||||||
const auto config = AutoLoadConfigFile(c.config_path);
|
const auto config = AutoLoadConfigFile(c.config_path);
|
||||||
|
|
||||||
EventThread io_thread;
|
EventThread io_thread;
|
||||||
|
io_thread.Start();
|
||||||
|
|
||||||
/* initialize the audio output */
|
/* initialize the audio output */
|
||||||
|
|
||||||
|
@ -114,6 +114,7 @@ public:
|
|||||||
GlobalInit(Path config_path)
|
GlobalInit(Path config_path)
|
||||||
:config(AutoLoadConfigFile(config_path))
|
:config(AutoLoadConfigFile(config_path))
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
EventLoop &GetEventLoop() noexcept {
|
EventLoop &GetEventLoop() noexcept {
|
||||||
|
@ -35,6 +35,7 @@ public:
|
|||||||
explicit GlobalInit(Path config_path)
|
explicit GlobalInit(Path config_path)
|
||||||
:config(AutoLoadConfigFile(config_path))
|
:config(AutoLoadConfigFile(config_path))
|
||||||
{
|
{
|
||||||
|
io_thread.Start();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user