Skip to content

Commit 3f7ccc0

Browse files
Fix spurious continue in the debug mode
This patch fixes the problem I came across when tried to use the debugger on MacOS with arm64. When Lua hit breakpoint it captured it though the program execution did not stop since the debug loop exited almost instantly. Debug prints showed that this happened due to the spurious wake ups of the conditional variable `cvRun`. None of the methods notified this conditional so it seems it is a spurious wake up. Probably it is specific to the architecture. This small patch fixes this by adding a predicate to the conditional variable. It waits until the debugging is finished or there are evals to run.
1 parent 7d0a4a9 commit 3f7ccc0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

emmy_debugger/src/debugger/emmy_debugger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ void Debugger::EnterDebugMode() {
660660
std::unique_lock<std::mutex> lockEval(evalMtx);
661661
if (evalQueue.empty() && blocking) {
662662
lockEval.unlock();
663-
cvRun.wait(lock);
663+
cvRun.wait(lock, [this] { return !blocking || !evalQueue.empty(); });
664664
lockEval.lock();
665665
}
666666
if (!evalQueue.empty()) {

0 commit comments

Comments
 (0)