[all-commits] [llvm/llvm-project] c25c6c: [lldb] Unify/improve MainLoop signal handling (#11...

Pavel Labath via All-commits all-commits at lists.llvm.org
Mon Nov 18 03:44:28 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c25c6c32494c8d1038438b6208d42ba40f25270e
      https://github.com/llvm/llvm-project/commit/c25c6c32494c8d1038438b6208d42ba40f25270e
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2024-11-18 (Mon, 18 Nov 2024)

  Changed paths:
    M lldb/include/lldb/Host/posix/MainLoopPosix.h
    M lldb/source/Host/posix/MainLoopPosix.cpp
    M lldb/unittests/Host/MainLoopTest.cpp

  Log Message:
  -----------
  [lldb] Unify/improve MainLoop signal handling (#115197)

Change the signal handler to use a pipe to notify about incoming
signals. This has two benefits:
- the signal no longer has to happen on the MainLoop thread. With the
previous implementation, this had to be the case as that was the only
way to ensure that ppoll gets interrupted correctly. In a multithreaded
process, this would mean that all other threads have to have the signal
blocked at all times.
- we don't need the android-specific workaround, which was necessary due
to the syscall being implemented in a non-atomic way

When the MainLoop class was first implemented, we did not have the
interrupt self-pipe, so syscall interruption was the most
straight-forward implementation. Over time, the class gained new
abilities (the pipe being one of them), so we can now piggy-back on
those.

This patch also changes the kevent-based implementation to use the pipe
for signal notification as well. The motivation there is slightly
different:
- it makes the implementations more uniform
- it makes sure we handle all kinds of signals, like we do with the
linux version (EVFILT_SIGNAL only catches process-directed signals)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list