mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-16 13:40:05 +02:00
Prevent data races in host callbacks
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include <boost/asio/local/stream_protocol.hpp>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "../common/logging.h"
|
||||
@@ -115,6 +116,13 @@ class PluginBridge {
|
||||
*/
|
||||
std::thread process_replacing_handler;
|
||||
|
||||
/**
|
||||
* A binary semaphore to prevent race conditions from the host callback
|
||||
* function being called by two threads at once. See `send_event()` for more
|
||||
* information.
|
||||
*/
|
||||
std::mutex host_callback_semaphore;
|
||||
|
||||
/**
|
||||
* A scratch buffer for sending and receiving data during `process` and
|
||||
* `processReplacing` calls.
|
||||
|
||||
Reference in New Issue
Block a user