From 3f7f67fc2d27312f4a9dc04306de461740b1d200 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Thu, 28 Jan 2021 23:45:44 +0100 Subject: [PATCH] Get rid of no longer used mutex This was left over from a very early version of yabridge. It's not needed since we have to initialize all VST2 plugins from the same thread anyways. --- src/wine-host/bridges/vst2.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/wine-host/bridges/vst2.cpp b/src/wine-host/bridges/vst2.cpp index 4138fa09..e7da986b 100644 --- a/src/wine-host/bridges/vst2.cpp +++ b/src/wine-host/bridges/vst2.cpp @@ -31,11 +31,6 @@ using VstEntryPoint = AEffect*(VST_CALL_CONV*)(audioMasterCallback); * from an `AEffect` when it performs a host callback during its initialization. */ Vst2Bridge* current_bridge_instance = nullptr; -/** - * Needed for the rare event that two plugins are getting initialized at the - * same time. - */ -std::mutex current_bridge_instance_mutex; /** * Opcodes that should always be handled on the main thread because they may @@ -101,24 +96,21 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context, sockets.connect(); - // Initialize after communication has been set up - // We'll try to do the same `get_bridge_instance` trick as in - // `plugin/plugin.cpp`, but since the plugin will probably call the host - // callback while it's initializing we sadly have to use a global here. - { - std::lock_guard lock(current_bridge_instance_mutex); - current_bridge_instance = this; - plugin = vst_entry_point(host_callback_proxy); - if (!plugin) { - throw std::runtime_error("VST plugin at '" + plugin_dll_path + - "' failed to initialize."); - } - - // We only needed this little hack during initialization - current_bridge_instance = nullptr; - plugin->ptr1 = this; + // Initialize after communication has been set up We'll try to do the same + // `get_bridge_instance` trick as in `plugin/bridges/vst2.cpp`, but since + // the plugin will probably call the host callback while it's initializing + // we sadly have to use a global here. + current_bridge_instance = this; + plugin = vst_entry_point(host_callback_proxy); + if (!plugin) { + throw std::runtime_error("VST plugin at '" + plugin_dll_path + + "' failed to initialize."); } + // We only needed this little hack during initialization + current_bridge_instance = nullptr; + plugin->ptr1 = this; + // Send the plugin's information to the Linux VST plugin. Any other updates // of this object will be sent over the `dispatcher()` socket. This would be // done after the host calls `effOpen()`, and when the plugin calls