-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
flatpak-spawn: Make signal handling async-signal-safe
signal(2) is annoying to use because the signal handler is restricted to a limited set of async-signal-safe functions (see signal-safety(7)). For example, the signal handler might be called while the same thread is halfway through a call to malloc(), so it is not necessarily safe for it to allocate memory - which is a problem, because g_idle_add() almost certainly allocates memory. Solving this portably would require tricky Unix code like the implementation that's behind g_unix_signal_source_new() (which we can't use directly here, because it is documented not to support SIGQUIT, SIGCONT or SIGTSTP). However, Flatpak is Linux-specific, and Linux since at least 2.6.27 (2008) implements signalfd(), which delivers signals into a poll()-based main loop - exactly what we want here. Resolves: #29 Signed-off-by: Simon McVittie <[email protected]>
- Loading branch information
Showing
3 changed files
with
130 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters