From 57017267cf75816233e20d5c31d531a89f9e1298 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 11 May 2023 18:38:02 +0200 Subject: [PATCH] Prefer try-lock in process-callback --- libs/ardour/audioengine.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc index d4d6f50851..70c6a8b34d 100644 --- a/libs/ardour/audioengine.cc +++ b/libs/ardour/audioengine.cc @@ -339,7 +339,12 @@ AudioEngine::process_callback (pframes_t nframes) } /* release latency lock, **before** reacquiring process-lock */ ll.release (); - tm.acquire (); + /* this should not be able to fail, but it is good practice + * to only use try-lock in the process callback. + */ + if (!tm.try_acquire ()) { + return 0; // XXX or spin? + } } } }