================ @@ -17,29 +17,53 @@ #include <cerrno> #include <csignal> #include <ctime> +#include <fcntl.h> #include <vector> // Multiplexing is implemented using kqueue on systems that support it (BSD -// variants including OSX). On linux we use ppoll, while android uses pselect -// (ppoll is present but not implemented properly). On windows we use WSApoll -// (which does not support signals). +// variants including OSX). On linux we use ppoll. #if HAVE_SYS_EVENT_H #include <sys/event.h> -#elif defined(__ANDROID__) -#include <sys/syscall.h> #else #include <poll.h> #endif using namespace lldb; using namespace lldb_private; -static sig_atomic_t g_signal_flags[NSIG]; +namespace { +struct GlobalSignalInfo { + sig_atomic_t pipe_fd = -1; + static_assert(sizeof(sig_atomic_t) >= sizeof(int), + "Type too small for a file descriptor"); + sig_atomic_t flag = 0; +}; +} // namespace +static GlobalSignalInfo g_signal_info[NSIG]; static void SignalHandler(int signo, siginfo_t *info, void *) { assert(signo < NSIG); - g_signal_flags[signo] = 1; + + // Set the flag before writing to the pipe! + g_signal_info[signo].flag = 1; + + char c = '.'; ---------------- labath wrote:
I added a comment about the intent. I think `c` is a good name for an entity with such a short scope. The choice of character is irrelevant -- we only need to write something to force `poll` to return. https://github.com/llvm/llvm-project/pull/115197 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits