Defer group host shutdown

This allows for a significant speedup in plugin scanning time for plugin
groups, since starting Wine processes takes up pretty much the entirety
of the time spent scanning plugins.
This commit is contained in:
Robbert van der Helm
2020-05-23 13:54:40 +02:00
parent 9f544c194a
commit f50d04ce04
2 changed files with 35 additions and 8 deletions
+12 -1
View File
@@ -126,7 +126,9 @@ class GroupBridge {
*
* Once the plugin has exited, this thread will then remove itself from the
* `active_plugins` map. If this causes the vector to become empty, we will
* terminate this process.
* terminate this process. This check will be delayed by a few seconds to
* prevent having to constantly restart the group process during plugin
* scanning.
*
* @param request Information about the plugin to launch, i.e. the path to
* the plugin and the path of the socket endpoint that will be used for
@@ -216,4 +218,13 @@ class GroupBridge {
* plugin is being spawned.
*/
std::mutex active_plugins_mutex;
/**
* A timer to defer shutting down the process, allowing for fast plugin
* scanning without having to start a new group host process for each
* plugin.
*
* @see handle_host_plugin
*/
boost::asio::steady_timer shutdown_timer;
};