mirror of https://github.com/davatorium/rofi.git
Move sigchld into signal handling thread.
This commit is contained in:
parent
89dcb5be1e
commit
9c53d0121d
|
@ -100,13 +100,6 @@ static int switcher_get ( const char *name )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void catch_exit ( G_GNUC_UNUSED int sig )
|
|
||||||
{
|
|
||||||
while ( 0 < waitpid ( -1, NULL, WNOHANG ) ) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Window main_window = None;
|
Window main_window = None;
|
||||||
GC gc = NULL;
|
GC gc = NULL;
|
||||||
Colormap map = None;
|
Colormap map = None;
|
||||||
|
@ -1825,6 +1818,7 @@ static gpointer rofi_signal_handler_process ( gpointer arg )
|
||||||
sigaddset ( &set, SIGHUP );
|
sigaddset ( &set, SIGHUP );
|
||||||
sigaddset ( &set, SIGINT );
|
sigaddset ( &set, SIGINT );
|
||||||
sigaddset ( &set, SIGUSR1 );
|
sigaddset ( &set, SIGUSR1 );
|
||||||
|
sigaddset ( &set, SIGCHLD );
|
||||||
// loop forever.
|
// loop forever.
|
||||||
while ( 1 ) {
|
while ( 1 ) {
|
||||||
siginfo_t info;
|
siginfo_t info;
|
||||||
|
@ -1844,6 +1838,10 @@ static gpointer rofi_signal_handler_process ( gpointer arg )
|
||||||
write ( pfd, "q", 1 );
|
write ( pfd, "q", 1 );
|
||||||
// Close my end and exit.
|
// Close my end and exit.
|
||||||
g_thread_exit ( NULL );
|
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, SIGHUP );
|
||||||
sigaddset ( &set, SIGINT );
|
sigaddset ( &set, SIGINT );
|
||||||
sigaddset ( &set, SIGUSR1 );
|
sigaddset ( &set, SIGUSR1 );
|
||||||
|
sigaddset ( &set, SIGCHLD );
|
||||||
sigprocmask ( SIG_BLOCK, &set, NULL );
|
sigprocmask ( SIG_BLOCK, &set, NULL );
|
||||||
// Create signal handler process.
|
// Create signal handler process.
|
||||||
// This will use sigwaitinfo to read signals and forward them back to the main thread again.
|
// 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 );
|
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 );
|
x11_setup ( display );
|
||||||
|
|
||||||
// Sanity check
|
// Sanity check
|
||||||
|
|
Loading…
Reference in New Issue