From 8131ad3c2491f4e8f85c7a59c9bb5e4acf6cb298 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Tue, 1 Mar 2022 19:59:48 +0100 Subject: [PATCH] Block when calling Stop() until macro is stopped --- src/macro.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/macro.cpp b/src/macro.cpp index 8113f122..b43c0935 100644 --- a/src/macro.cpp +++ b/src/macro.cpp @@ -180,6 +180,15 @@ void Macro::SetPaused(bool pause) _paused = pause; } +void Macro::Stop() +{ + _stop = true; + switcher->macroWaitCv.notify_all(); + if (_thread.joinable()) { + _thread.join(); + } +} + void Macro::UpdateActionIndices() { int idx = 0;