mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-17 08:53:56 +02:00
Add thread names
This commit is contained in:
@@ -103,7 +103,11 @@ GroupBridge::GroupBridge(boost::filesystem::path group_socket_path)
|
||||
logger.async_log_pipe_lines(stderr_redirect.pipe, stderr_buffer,
|
||||
"[STDERR] ");
|
||||
|
||||
stdio_handler = Win32Thread([&]() { stdio_context.run(); });
|
||||
stdio_handler = Win32Thread([&]() {
|
||||
pthread_setname_np(pthread_self(), "group-stdio");
|
||||
|
||||
stdio_context.run();
|
||||
});
|
||||
}
|
||||
|
||||
GroupBridge::~GroupBridge() noexcept {
|
||||
@@ -238,6 +242,10 @@ void GroupBridge::accept_requests() {
|
||||
const size_t plugin_id = next_plugin_id.fetch_add(1);
|
||||
active_plugins[plugin_id] = std::pair(
|
||||
Win32Thread([this, plugin_id, plugin_ptr = bridge.get()]() {
|
||||
const std::string thread_name =
|
||||
"worker-" + std::to_string(plugin_id);
|
||||
pthread_setname_np(pthread_self(), thread_name.c_str());
|
||||
|
||||
handle_plugin_run(plugin_id, plugin_ptr);
|
||||
}),
|
||||
std::move(bridge));
|
||||
|
||||
@@ -221,6 +221,7 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
|
||||
|
||||
parameters_handler = Win32Thread([&]() {
|
||||
set_realtime_priority(true);
|
||||
pthread_setname_np(pthread_self(), "parameters");
|
||||
|
||||
sockets.host_vst_parameters.receive_multi<Parameter>(
|
||||
[&](Parameter& request, SerializationBufferBase& buffer) {
|
||||
@@ -246,6 +247,7 @@ Vst2Bridge::Vst2Bridge(MainContext& main_context,
|
||||
|
||||
process_replacing_handler = Win32Thread([&]() {
|
||||
set_realtime_priority(true);
|
||||
pthread_setname_np(pthread_self(), "audio");
|
||||
|
||||
// Most plugins will already enable FTZ, but there are a handful of
|
||||
// plugins that don't that suffer from extreme DSP load increases when
|
||||
|
||||
@@ -1183,6 +1183,13 @@ size_t Vst3Bridge::register_object_instance(
|
||||
.audio_processor_handler = Win32Thread([&, instance_id]() {
|
||||
set_realtime_priority(true);
|
||||
|
||||
// XXX: Like with VST2 worker threads, when using plugin groups the
|
||||
// thread names from different plugins will clash. Not a huge
|
||||
// deal probably, since duplicate thread names are still more
|
||||
// useful than no thread names.
|
||||
const std::string thread_name = "audio-" + std::to_string(instance_id);
|
||||
pthread_setname_np(pthread_self(), thread_name.c_str());
|
||||
|
||||
sockets.add_audio_processor_and_listen(
|
||||
instance_id, socket_listening_latch,
|
||||
overload{
|
||||
|
||||
@@ -117,6 +117,8 @@ __cdecl
|
||||
// potentially unsafe events that should always be run from the UI thread
|
||||
// will be posted to `main_context`.
|
||||
Win32Thread worker_thread([&]() {
|
||||
pthread_setname_np(pthread_self(), "worker");
|
||||
|
||||
bridge->run();
|
||||
|
||||
// // When the sockets get closed, this application should
|
||||
|
||||
@@ -86,7 +86,11 @@ MainContext::MainContext()
|
||||
// we'll run the timer on a 30 second interval.
|
||||
async_handle_watchdog_timer(5s);
|
||||
|
||||
watchdog_handler = Win32Thread([&]() { watchdog_context.run(); });
|
||||
watchdog_handler = Win32Thread([&]() {
|
||||
pthread_setname_np(pthread_self(), "watchdog");
|
||||
|
||||
watchdog_context.run();
|
||||
});
|
||||
}
|
||||
|
||||
void MainContext::run() {
|
||||
|
||||
Reference in New Issue
Block a user