mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 20:40:11 +02:00
Rearrange the try-catch in the thread handlers
It's a bit clearer this way. I would prefer using jthreads here, but we would still need this try-catch block since there's no way to cancel synchronous Boost.Asio socket operations other than closing the socket.
This commit is contained in:
@@ -132,8 +132,8 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
|
||||
// instead of asynchronous IO since communication has to be handled in
|
||||
// lockstep anyway
|
||||
host_callback_handler = std::thread([&]() {
|
||||
try {
|
||||
while (true) {
|
||||
while (true) {
|
||||
try {
|
||||
// TODO: Think of a nicer way to structure this and the similar
|
||||
// handler in `Vst2Bridge::handle_dispatch_midi_events`
|
||||
receive_event(
|
||||
@@ -159,10 +159,11 @@ PluginBridge::PluginBridge(audioMasterCallback host_callback)
|
||||
&plugin, host_callback_function)(event);
|
||||
}
|
||||
});
|
||||
} catch (const boost::system::system_error&) {
|
||||
// This happens when the sockets got closed because the plugin
|
||||
// is being shut down
|
||||
break;
|
||||
}
|
||||
} catch (const boost::system::system_error&) {
|
||||
// This happens when the sockets got closed because the plugin
|
||||
// is being shut down
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user