Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal handling fixes #3669

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Commits on Oct 6, 2024

  1. refactor: move Unix signal handling to a thread

    The previous implementation was not async-signal-safe and could cause
    lots of hard to debug issues.
    
    The common ways to handle that include
     * Self-pipe and non-allocating lock-free set of pending signals in the
       main thread (see `g_unix_signal_source_new` for example).
     * A dedicated signal handling thread calling `sigtimedwait`.
     * Linux-specific solution with `signalfd(2)`.
     * FreeBSD-specific solution with `EVFILT_SIGNAL` filter for `kqueue`.
    
    `GUnixSignalSource` intentionally supports a very limited set of
    signals, making it a bad fit for us. There's also no benefit in
    maintaining a set of platform-dependent solutions. Therefore, extending
    an existing `signalThread` code seems to be the best option.
    
    All the threads and child processes inherit the signal mask we set in
    `UnixSignalHandler::start()`, and now we block a few more signals.
    That requires an extra care when forking and starting new processes.
    Thankfully, `waybar::util::command` already does everything necessary
    and appears to be used consistently across the source.
    alebastr committed Oct 6, 2024
    Configuration menu
    Copy the full SHA
    d1a44fa View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2024

  1. refactor: improve handling of reload signal (SIGUSR2)

    Repeated calls to `Client::main()` result in unnecessary work and
    duplication of several event handlers. A common consequence of that is
    the bug with multiple bars being created (Alexays#3344).
    
    This change ensures that the `main` is called only once and makes reload
    logic much simpler.
    alebastr committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    d8a7f42 View commit details
    Browse the repository at this point in the history