Rename handle_plugin_dispatch to *_run

Since run() is now the general `HostBridge()` function to listen for
incoming events.
This commit is contained in:
Robbert van der Helm
2020-12-12 13:34:30 +01:00
parent 4f8fe21fa9
commit 0214221c3a
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -111,7 +111,7 @@ GroupBridge::~GroupBridge() {
stdio_context.stop(); stdio_context.stop();
} }
void GroupBridge::handle_plugin_dispatch(size_t plugin_id, HostBridge* bridge) { void GroupBridge::handle_plugin_run(size_t plugin_id, HostBridge* bridge) {
// Blocks this thread until the plugin shuts down // Blocks this thread until the plugin shuts down
bridge->run(); bridge->run();
logger.log("'" + bridge->plugin_path.string() + "' has exited"); logger.log("'" + bridge->plugin_path.string() + "' has exited");
@@ -236,7 +236,7 @@ void GroupBridge::accept_requests() {
const size_t plugin_id = next_plugin_id.fetch_add(1); const size_t plugin_id = next_plugin_id.fetch_add(1);
active_plugins[plugin_id] = std::pair( active_plugins[plugin_id] = std::pair(
Win32Thread([this, plugin_id, plugin_ptr = bridge.get()]() { Win32Thread([this, plugin_id, plugin_ptr = bridge.get()]() {
handle_plugin_dispatch(plugin_id, plugin_ptr); handle_plugin_run(plugin_id, plugin_ptr);
}), }),
std::move(bridge)); std::move(bridge));
} catch (const std::runtime_error& error) { } catch (const std::runtime_error& error) {
+7 -7
View File
@@ -148,7 +148,7 @@ class GroupBridge {
* then the process will never exit on its own. This should not happen * then the process will never exit on its own. This should not happen
* though. * though.
*/ */
void handle_plugin_dispatch(size_t plugin_id, HostBridge* bridge); void handle_plugin_run(size_t plugin_id, HostBridge* bridge);
/** /**
* Listen for new requests to spawn plugins within this process and handle * Listen for new requests to spawn plugins within this process and handle
@@ -164,14 +164,14 @@ class GroupBridge {
* the yabridge instance can tell if the plugin crashed during * the yabridge instance can tell if the plugin crashed during
* initialization, and it will then try to initialize the plugin. After * initialization, and it will then try to initialize the plugin. After
* intialization the plugin handling will be handed over to a new thread * intialization the plugin handling will be handed over to a new thread
* running `handle_plugin_dispatch()`. Because of the way the Win32 API * running `handle_plugin_run()`. Because of the way the Win32 API works,
* works, all plugins have to be initialized from the same thread, and all * all plugins have to be initialized from the same thread, and all event
* event handling and message loop interaction also has to be done from that * handling and message loop interaction also has to be done from that
* thread, which is why we initialize the plugin here and use the * thread, which is why we initialize the plugin here and use the
* `handle_dispatch()` function to run events within the same * `handle_dispatch()` function to run events within the same
* `main_context`. * `main_context`.
* *
* @see handle_plugin_dispatch * @see handle_plugin_run
*/ */
void accept_requests(); void accept_requests();
@@ -263,7 +263,7 @@ class GroupBridge {
std::atomic_size_t next_plugin_id; std::atomic_size_t next_plugin_id;
/** /**
* A mutex to prevent two threads from simultaneously accessing the plugins * A mutex to prevent two threads from simultaneously accessing the plugins
* map, and also to prevent `handle_plugin_dispatch()` from terminating the * map, and also to prevent `handle_plugin_run()` from terminating the
* process because it thinks there are no active plugins left just as a new * process because it thinks there are no active plugins left just as a new
* plugin is being spawned. * plugin is being spawned.
*/ */
@@ -274,7 +274,7 @@ class GroupBridge {
* scanning without having to start a new group host process for each * scanning without having to start a new group host process for each
* plugin. * plugin.
* *
* @see handle_plugin_dispatch * @see handle_plugin_run
*/ */
boost::asio::steady_timer shutdown_timer; boost::asio::steady_timer shutdown_timer;
/** /**