mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 08:59:58 +00:00
signal -> sigaction
This commit is contained in:
parent
0337e4fc0f
commit
3e1b621e7a
12
gfx/rpi.c
12
gfx/rpi.c
@ -66,12 +66,12 @@ typedef struct {
|
||||
#endif
|
||||
} rpi_t;
|
||||
|
||||
static bool rpi_shutdown = false;
|
||||
static volatile sig_atomic_t rpi_shutdown = 0;
|
||||
|
||||
static void rpi_kill(int sig)
|
||||
{
|
||||
(void)sig;
|
||||
rpi_shutdown = true;
|
||||
rpi_shutdown = 1;
|
||||
}
|
||||
|
||||
static void rpi_set_nonblock_state(void *data, bool state)
|
||||
@ -219,8 +219,12 @@ static void *rpi_init(const video_info_t *video, const input_driver_t **input, v
|
||||
}
|
||||
#endif
|
||||
|
||||
signal(SIGINT, rpi_kill);
|
||||
signal(SIGTERM, rpi_kill);
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = rpi_kill;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGTERM, &sa, NULL);
|
||||
|
||||
return rpi;
|
||||
}
|
||||
|
@ -164,7 +164,6 @@ static void linuxraw_resetKbmd()
|
||||
static void linuxraw_exitGracefully(int sig)
|
||||
{
|
||||
linuxraw_resetKbmd();
|
||||
signal(sig, SIG_DFL);
|
||||
kill(getpid(), sig);
|
||||
}
|
||||
|
||||
@ -199,13 +198,17 @@ static void *linuxraw_input_init(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = linuxraw_exitGracefully;
|
||||
sa.sa_flags = SA_RESTART | SA_RESETHAND;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
// trap some standard termination codes so we can restore the keyboard before we lose control
|
||||
signal(SIGABRT, linuxraw_exitGracefully);
|
||||
signal(SIGBUS, linuxraw_exitGracefully);
|
||||
signal(SIGFPE, linuxraw_exitGracefully);
|
||||
signal(SIGILL, linuxraw_exitGracefully);
|
||||
signal(SIGQUIT, linuxraw_exitGracefully);
|
||||
signal(SIGSEGV, linuxraw_exitGracefully);
|
||||
sigaction(SIGABRT, &sa, NULL);
|
||||
sigaction(SIGBUS, &sa, NULL);
|
||||
sigaction(SIGFPE, &sa, NULL);
|
||||
sigaction(SIGILL, &sa, NULL);
|
||||
sigaction(SIGQUIT, &sa, NULL);
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
|
||||
atexit(linuxraw_resetKbmd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user