Skip to content

Fix signal safety deadlock #4048

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

LiterallyVoid
Copy link

Fixes #4047.

This creates a separate thread to watch for signals. I used a pipe to send signals to the signal thread, as pipes are one of the few signal-safe messaging options.

Because GTK isn't thread safe, I couldn't handle signals in the signal thread either, so I used a SafeSignal which is thread-safe (but probably not signal-safe!) so that signals were handled on the main thread.

I also moved the SIGCHLD handling code into the new thread. I'm unsure about this change, as it will longer mask SIGCHLD in the main thread. From a cursory test it seems to work and children are still being reaped correctly, but I separated this change into its own commit so it can be reverted separately.

(Incidentally, all of reload's accesses were on the same thread, so I changed it from a global to a local.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reproducible Deadlock
1 participant