================
@@ -781,15 +784,61 @@ int main(int argc, char const *argv[]) {
   // Setup LLDB signal handlers once the debugger has been initialized.
   SBDebugger::PrintDiagnosticsOnError();
 
-  //  FIXME: Migrate the SIGINT handler to be handled by the signal loop below.
+#ifdef _WIN32
   signal(SIGINT, sigint_handler);
-#if !defined(_WIN32)
+#else
   signal(SIGPIPE, SIG_IGN);
 
+  // Capture the main thread's id so the signal thread can target it.
+  pthread_t main_thread = pthread_self();
+
+  // Set when the signal thread sends itself a SIGINT to wake the main thread.
+  // The next SIGINT callback invocation observes this flag and skips the work.
+  std::atomic<bool> skip_next_sigint{false};
----------------
labath wrote:

This doesn't need to be atomic since it's only accessed from the signal handler 
thread. You could emphasize that by declaring the variable inside the callback.

https://github.com/llvm/llvm-project/pull/195959
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to