input/Init: add RAII class

This commit is contained in:
Max Kellermann
2019-02-05 21:50:31 +01:00
parent b0739eca87
commit 9e73ea77b4
9 changed files with 39 additions and 39 deletions

View File

@@ -108,18 +108,14 @@ class GlobalInit {
const ScopeArchivePluginsInit archive_plugins_init;
#endif
const ScopeInputPluginsInit input_plugins_init;
public:
explicit GlobalInit(Path config_path)
:config(AutoLoadConfigFile(config_path))
:config(AutoLoadConfigFile(config_path)),
input_plugins_init(config, io_thread.GetEventLoop())
{
io_thread.Start();
input_stream_global_init(config,
io_thread.GetEventLoop());
}
~GlobalInit() {
input_stream_global_finish();
}
};