[Lldb-commits] [lldb] [lldb] Unify/improve MainLoop signal handling (PR #115197)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Nov 18 01:35:45 PST 2024


================
@@ -295,26 +243,17 @@ MainLoopPosix::RegisterSignal(int signo, const Callback &callback,
   sigaddset(&new_action.sa_mask, signo);
   sigset_t old_set;
 
-  g_signal_flags[signo] = 0;
+  // Set signal info before installing the signal handler!
+  g_signal_info[signo].pipe_fd = m_trigger_pipe.GetWriteFileDescriptor();
----------------
labath wrote:

It can happen if we have multiple MainLoop instances listening for different signals. Currently we are promising that to work, although I don't think anyone makes use of that ability, nor do I expect anyone to use for the foreseeable future. So, the answer could be yes or no, depending on how you meant the question.

I do think this is a nice property to have ("you can only have one main loop listening for a specific signal" sounds better than "you can only have one main loop listening for signals"), and I don't think the alternatives would be much simpler.

https://github.com/llvm/llvm-project/pull/115197


More information about the lldb-commits mailing list