From aa6c011398fc6d80b21422e26355c7d38240a284 Mon Sep 17 00:00:00 2001 From: jatinchowdhury18 Date: Sat, 30 Dec 2023 01:18:48 -0800 Subject: [PATCH] DeferredMainThreadAction: add bool return value (#479) --- .../Threads/chowdsp_DeferredMainThreadAction.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h index 2e391363d..4d0394284 100644 --- a/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h +++ b/modules/plugin/chowdsp_plugin_utils/Threads/chowdsp_DeferredMainThreadAction.h @@ -43,22 +43,22 @@ class DeferredAction : public juce::Timer * thread, make sure to set `couldBeAudioThread = true`. */ template - void call (Callable&& operationToDefer, bool couldBeAudioThread = false) + bool call (Callable&& operationToDefer, bool couldBeAudioThread = false) { if (juce::MessageManager::existsAndIsCurrentThread()) { operationToDefer(); - return; + return true; } + auto success = true; if (couldBeAudioThread) { - const auto success = queue.try_enqueue (std::forward (operationToDefer)); + success = queue.try_enqueue (std::forward (operationToDefer)); // The queue doesn't have enough space for all these messages! // Consider changing the default size of the queue. jassert (success); - juce::ignoreUnused (success); } else { @@ -68,6 +68,7 @@ class DeferredAction : public juce::Timer } callbacksReady.store (true); + return success; } private: