Rename PluginContext to MainContext for clarity

This commit is contained in:
Robbert van der Helm
2020-10-28 01:02:56 +01:00
parent fac820c25a
commit bece654c2d
7 changed files with 47 additions and 46 deletions
+9 -9
View File
@@ -84,14 +84,14 @@ StdIoCapture::~StdIoCapture() {
GroupBridge::GroupBridge(boost::filesystem::path group_socket_path)
: logger(Logger::create_from_environment(
create_logger_prefix(group_socket_path))),
plugin_context(),
main_context(),
stdio_context(),
stdout_redirect(stdio_context, STDOUT_FILENO),
stderr_redirect(stdio_context, STDERR_FILENO),
group_socket_endpoint(group_socket_path.string()),
group_socket_acceptor(create_acceptor_if_inactive(plugin_context.context,
group_socket_acceptor(create_acceptor_if_inactive(main_context.context,
group_socket_endpoint)),
shutdown_timer(plugin_context.context) {
shutdown_timer(main_context.context) {
// Write this process's original STDOUT and STDERR streams to the logger
// TODO: This works for output generated by plugins, but not for debug
// messages generated by wineserver. Is it possible to catch those?
@@ -125,7 +125,7 @@ void GroupBridge::handle_plugin_dispatch(size_t plugin_id) {
// potentially corrupt our heap. This way we can also properly join the
// thread again. If no active plugins remain, then we'll terminate the
// process.
boost::asio::post(plugin_context.context, [this, plugin_id]() {
boost::asio::post(main_context.context, [this, plugin_id]() {
std::lock_guard lock(active_plugins_mutex);
// The join is implicit because we're using Win32Thread (which mimics
@@ -147,7 +147,7 @@ void GroupBridge::handle_plugin_dispatch(size_t plugin_id) {
if (active_plugins.size() == 0) {
logger.log(
"All plugins have exited, shutting down the group process");
plugin_context.stop();
main_context.stop();
}
});
}
@@ -158,7 +158,7 @@ void GroupBridge::handle_incoming_connections() {
logger.log(
"Group host is up and running, now accepting incoming connections");
plugin_context.run();
main_context.run();
}
bool GroupBridge::should_skip_message_loop() {
@@ -188,7 +188,7 @@ void GroupBridge::accept_requests() {
logger.log("Error while listening for incoming connections:");
logger.log(error.message());
plugin_context.stop();
main_context.stop();
}
// Read the parameters, and then host the plugin in this process
@@ -208,7 +208,7 @@ void GroupBridge::accept_requests() {
request.endpoint_base_dir + "'");
try {
auto bridge = std::make_unique<Vst2Bridge>(
plugin_context, request.plugin_path,
main_context, request.plugin_path,
request.endpoint_base_dir);
logger.log("Finished initializing '" + request.plugin_path +
"'");
@@ -235,7 +235,7 @@ void GroupBridge::accept_requests() {
}
void GroupBridge::async_handle_events() {
plugin_context.async_handle_events([&]() {
main_context.async_handle_events([&]() {
{
// Always handle X11 events
std::lock_guard lock(active_plugins_mutex);