mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-15 04:50:43 +02:00
Replace Boost.Asio with standalone Asio library
We had to add an even hackier hack now to get Boost.Process to interoperate with Asio's IO contexts. This will be replaced later when we replace Boost.Process.
This commit is contained in:
@@ -74,7 +74,7 @@ class PluginBridge {
|
||||
* found, or if it could not locate and load a VST3 module.
|
||||
*/
|
||||
template <invocable_returning<TSockets,
|
||||
boost::asio::io_context&,
|
||||
asio::io_context&,
|
||||
const PluginInfo&> F>
|
||||
PluginBridge(PluginType plugin_type, F&& create_socket_instance)
|
||||
// This is still correct for VST3 plugins because we can configure an
|
||||
@@ -367,7 +367,7 @@ class PluginBridge {
|
||||
// sockets and we'll be hanging here indefinitely. To prevent this,
|
||||
// we'll periodically poll whether the Wine process is still running,
|
||||
// and throw when it is not. The alternative would be to rewrite this to
|
||||
// using `async_accept`, Boost.Asio timers, and another IO context, but
|
||||
// using `async_accept`, Asio timers, and another IO context, but
|
||||
// I feel like this a much simpler solution.
|
||||
host_watchdog_handler_ = std::jthread([&](std::stop_token st) {
|
||||
using namespace std::literals::chrono_literals;
|
||||
@@ -441,7 +441,7 @@ class PluginBridge {
|
||||
*/
|
||||
const PluginInfo info_;
|
||||
|
||||
boost::asio::io_context io_context_;
|
||||
asio::io_context io_context_;
|
||||
|
||||
/**
|
||||
* The sockets used for communication with the Wine process.
|
||||
@@ -485,7 +485,7 @@ class PluginBridge {
|
||||
std::future<bool> has_realtime_priority_;
|
||||
|
||||
/**
|
||||
* Runs the Boost.Asio `io_context_` thread for logging the Wine process
|
||||
* Runs the Asio `io_context_` thread for logging the Wine process
|
||||
* STDOUT and STDERR messages.
|
||||
*/
|
||||
std::jthread wine_io_handler_;
|
||||
|
||||
@@ -38,7 +38,7 @@ Vst2PluginBridge& get_bridge_instance(const AEffect& plugin) noexcept {
|
||||
Vst2PluginBridge::Vst2PluginBridge(audioMasterCallback host_callback)
|
||||
: PluginBridge(
|
||||
PluginType::vst2,
|
||||
[](boost::asio::io_context& io_context, const PluginInfo& info) {
|
||||
[](asio::io_context& io_context, const PluginInfo& info) {
|
||||
return Vst2Sockets<std::jthread>(
|
||||
io_context,
|
||||
generate_endpoint_base(info.native_library_path_.filename()
|
||||
@@ -199,7 +199,7 @@ Vst2PluginBridge::~Vst2PluginBridge() noexcept {
|
||||
// The `stop()` method will cause the IO context to just drop all of its
|
||||
// outstanding work immediately
|
||||
io_context_.stop();
|
||||
} catch (const boost::system::system_error&) {
|
||||
} catch (const std::system_error&) {
|
||||
// It could be that the sockets have already been closed or that the
|
||||
// process has already exited (at which point we probably won't be
|
||||
// executing this, but maybe if all the stars align)
|
||||
@@ -538,7 +538,7 @@ intptr_t Vst2PluginBridge::dispatch(AEffect* /*plugin*/,
|
||||
return_value = sockets_.host_vst_dispatch_.send_event(
|
||||
converter, std::pair<Vst2Logger&, bool>(logger_, true),
|
||||
opcode, index, value, data, option);
|
||||
} catch (const boost::system::system_error&) {
|
||||
} catch (const std::system_error&) {
|
||||
// Thrown when the socket gets closed because the VST plugin
|
||||
// loaded into the Wine process crashed during shutdown
|
||||
logger_.log("The plugin crashed during shutdown, ignoring");
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <vestige/aeffectx.h>
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <asio/io_context.hpp>
|
||||
#include <thread>
|
||||
|
||||
#include "../../common/communication/vst2.h"
|
||||
|
||||
@@ -32,7 +32,7 @@ class RunLoopTasks : public Steinberg::Linux::IEventHandler {
|
||||
public:
|
||||
/**
|
||||
* Register an event handler in the host's run loop so we can schedule tasks
|
||||
* to be run from there. This works very much like how we use Boost.Asio IO
|
||||
* to be run from there. This works very much like how we use Asio IO
|
||||
* contexts everywhere else to run functions on other threads. All of this
|
||||
* is backed by a dummy Unix domain socket, although REAPER will call the
|
||||
* event handler regardless of whether the file descriptor is ready or not.
|
||||
|
||||
@@ -27,7 +27,7 @@ using namespace std::literals::string_literals;
|
||||
Vst3PluginBridge::Vst3PluginBridge()
|
||||
: PluginBridge(
|
||||
PluginType::vst3,
|
||||
[](boost::asio::io_context& io_context, const PluginInfo& info) {
|
||||
[](asio::io_context& io_context, const PluginInfo& info) {
|
||||
return Vst3Sockets<std::jthread>(
|
||||
io_context,
|
||||
generate_endpoint_base(info.native_library_path_.filename()
|
||||
@@ -415,7 +415,7 @@ Vst3PluginBridge::~Vst3PluginBridge() noexcept {
|
||||
// Drop all work make sure all sockets are closed
|
||||
plugin_host_->terminate();
|
||||
io_context_.stop();
|
||||
} catch (const boost::system::system_error&) {
|
||||
} catch (const std::system_error&) {
|
||||
// It could be that the sockets have already been closed or that the
|
||||
// process has already exited (at which point we probably won't be
|
||||
// executing this, but maybe if all the stars align)
|
||||
|
||||
Reference in New Issue
Block a user