summaryrefslogtreecommitdiff
path: root/tools/lldb-mi/MIDriverMain.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:12:36 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:12:36 +0000
commitef5d0b5e97ec8e6fa395d377b09aa7755e345b4f (patch)
tree27916256fdeeb57d10d2f3d6948be5d71a703215 /tools/lldb-mi/MIDriverMain.cpp
parent76e0736e7fcfeb179779e49c05604464b1ccd704 (diff)
Notes
Diffstat (limited to 'tools/lldb-mi/MIDriverMain.cpp')
-rw-r--r--tools/lldb-mi/MIDriverMain.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/lldb-mi/MIDriverMain.cpp b/tools/lldb-mi/MIDriverMain.cpp
index be01f1d977901..eda67782ad677 100644
--- a/tools/lldb-mi/MIDriverMain.cpp
+++ b/tools/lldb-mi/MIDriverMain.cpp
@@ -33,6 +33,7 @@
// Third party headers:
#include "lldb/API/SBHostOS.h"
+#include <atomic>
#include <csignal>
#include <stdio.h>
@@ -72,14 +73,13 @@ void sigint_handler(int vSigno) {
#ifdef _WIN32 // Restore handler as it is not persistent on Windows
signal(SIGINT, sigint_handler);
#endif
- static bool g_interrupt_sent = false;
+ static std::atomic_flag g_interrupt_sent = ATOMIC_FLAG_INIT;
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
if (pDebugger != nullptr) {
- if (!g_interrupt_sent) {
- g_interrupt_sent = true;
+ if (!g_interrupt_sent.test_and_set()) {
pDebugger->DispatchInputInterrupt();
- g_interrupt_sent = false;
+ g_interrupt_sent.clear();
}
}