mirror of
https://github.com/davatorium/rofi.git
synced 2025-01-27 15:25:24 -05:00
Move sigchld into signal handling thread.
This commit is contained in:
parent
89dcb5be1e
commit
9c53d0121d
1 changed files with 6 additions and 13 deletions
|
@ -100,13 +100,6 @@ static int switcher_get ( const char *name )
|
|||
return -1;
|
||||
}
|
||||
|
||||
void catch_exit ( G_GNUC_UNUSED int sig )
|
||||
{
|
||||
while ( 0 < waitpid ( -1, NULL, WNOHANG ) ) {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
Window main_window = None;
|
||||
GC gc = NULL;
|
||||
Colormap map = None;
|
||||
|
@ -1825,6 +1818,7 @@ static gpointer rofi_signal_handler_process ( gpointer arg )
|
|||
sigaddset ( &set, SIGHUP );
|
||||
sigaddset ( &set, SIGINT );
|
||||
sigaddset ( &set, SIGUSR1 );
|
||||
sigaddset ( &set, SIGCHLD );
|
||||
// loop forever.
|
||||
while ( 1 ) {
|
||||
siginfo_t info;
|
||||
|
@ -1844,6 +1838,10 @@ static gpointer rofi_signal_handler_process ( gpointer arg )
|
|||
write ( pfd, "q", 1 );
|
||||
// Close my end and exit.
|
||||
g_thread_exit ( NULL );
|
||||
}else if ( sig == SIGCHLD ) {
|
||||
while ( 0 < waitpid ( -1, NULL, WNOHANG ) ) {
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1920,6 +1918,7 @@ static GThread *setup_signal_thread ( int *fd )
|
|||
sigaddset ( &set, SIGHUP );
|
||||
sigaddset ( &set, SIGINT );
|
||||
sigaddset ( &set, SIGUSR1 );
|
||||
sigaddset ( &set, SIGCHLD );
|
||||
sigprocmask ( SIG_BLOCK, &set, NULL );
|
||||
// Create signal handler process.
|
||||
// This will use sigwaitinfo to read signals and forward them back to the main thread again.
|
||||
|
@ -2014,12 +2013,6 @@ int main ( int argc, char *argv[] )
|
|||
load_configuration_dynamic ( display );
|
||||
}
|
||||
|
||||
// Set up X interaction.
|
||||
const struct sigaction sigchld_action = {
|
||||
.sa_handler = catch_exit
|
||||
};
|
||||
sigaction ( SIGCHLD, &sigchld_action, NULL );
|
||||
|
||||
x11_setup ( display );
|
||||
|
||||
// Sanity check
|
||||
|
|
Loading…
Add table
Reference in a new issue