mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add an environment variable for disabling watchdog
This should only be used when running the Wine process under a separate namespace.
This commit is contained in:
@@ -8,6 +8,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Added an environment variable to disable the watchdog timer. This allows the
|
||||||
|
Wine process to run under a separate namespace. If you don't know that you
|
||||||
|
need this, then you probably don't need this!
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- The audio processing implementation for both VST2 and VST3 plugins has been
|
- The audio processing implementation for both VST2 and VST3 plugins has been
|
||||||
|
|||||||
@@ -654,6 +654,11 @@ the yabridge [Discord](https://discord.gg/pyNeweqadf).
|
|||||||
[plugin groups](#plugin-groups) to run multiple instances of your most
|
[plugin groups](#plugin-groups) to run multiple instances of your most
|
||||||
frequently used plugins within a single process.
|
frequently used plugins within a single process.
|
||||||
|
|
||||||
|
- If you're using a `WINELOADER` that runs the Wine process under a separate
|
||||||
|
namespace while the host is not sandboxed, then you'll have to use the
|
||||||
|
`YABRIDGE_NO_WATCHDOG` environment variable to disable the watchdog timer. If
|
||||||
|
you know what this means then you probably know what you're doing.
|
||||||
|
|
||||||
## Performance tuning
|
## Performance tuning
|
||||||
|
|
||||||
Running Windows plugins under Wine should have a minimal performance overhead,
|
Running Windows plugins under Wine should have a minimal performance overhead,
|
||||||
|
|||||||
+27
-2
@@ -16,10 +16,23 @@
|
|||||||
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include <boost/process/environment.hpp>
|
||||||
|
|
||||||
#include "bridges/common.h"
|
#include "bridges/common.h"
|
||||||
|
|
||||||
|
namespace bp = boost::process;
|
||||||
|
|
||||||
using namespace std::literals::chrono_literals;
|
using namespace std::literals::chrono_literals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this environment variable is set to `1`, then we won't enable the watchdog
|
||||||
|
* timer. This is only necessary when running the Wine process under a different
|
||||||
|
* namespace than the host.
|
||||||
|
*/
|
||||||
|
constexpr char disable_watchdog_timer_env_var[] = "YABRIDGE_NO_WATCHDOG";
|
||||||
|
|
||||||
uint32_t WINAPI
|
uint32_t WINAPI
|
||||||
win32_thread_trampoline(fu2::unique_function<void()>* entry_point) {
|
win32_thread_trampoline(fu2::unique_function<void()>* entry_point) {
|
||||||
(*entry_point)();
|
(*entry_point)();
|
||||||
@@ -81,9 +94,21 @@ MainContext::MainContext()
|
|||||||
events_timer(context),
|
events_timer(context),
|
||||||
watchdog_context(),
|
watchdog_context(),
|
||||||
watchdog_timer(watchdog_context) {
|
watchdog_timer(watchdog_context) {
|
||||||
|
bp::environment env = boost::this_process::environment();
|
||||||
|
|
||||||
|
// NOTE: We allow disabling the watchdog timer to allow the Wine process to
|
||||||
|
// be run from a separate namespace. This is not something you'd
|
||||||
|
// normally want to enable.
|
||||||
|
if (env[disable_watchdog_timer_env_var].to_string() == "1") {
|
||||||
|
std::cerr << "WARNING: Watchdog timer disabled. Not protecting"
|
||||||
|
<< std::endl;
|
||||||
|
std::cerr << " against dangling processes." << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// To account for hosts terminating before the bridged plugin has
|
// To account for hosts terminating before the bridged plugin has
|
||||||
// initialized, we'll do the first watchdog check five seconds. After this
|
// initialized, we'll do the first watchdog check five seconds. After
|
||||||
// we'll run the timer on a 30 second interval.
|
// this we'll run the timer on a 30 second interval.
|
||||||
async_handle_watchdog_timer(5s);
|
async_handle_watchdog_timer(5s);
|
||||||
|
|
||||||
watchdog_handler = Win32Thread([&]() {
|
watchdog_handler = Win32Thread([&]() {
|
||||||
|
|||||||
Reference in New Issue
Block a user