move SIGINT and SIGTERM handlers to video driver

This commit is contained in:
Toad King 2012-06-19 13:40:49 -04:00
parent 55b7267694
commit 0337e4fc0f
2 changed files with 12 additions and 3 deletions

View File

@ -66,6 +66,14 @@ typedef struct {
#endif
} rpi_t;
static bool rpi_shutdown = false;
static void rpi_kill(int sig)
{
(void)sig;
rpi_shutdown = true;
}
static void rpi_set_nonblock_state(void *data, bool state)
{
rpi_t *rpi = (rpi_t*)data;
@ -211,6 +219,9 @@ static void *rpi_init(const video_info_t *video, const input_driver_t **input, v
}
#endif
signal(SIGINT, rpi_kill);
signal(SIGTERM, rpi_kill);
return rpi;
}
@ -402,7 +413,7 @@ static bool rpi_frame(void *data, const void *frame, unsigned width, unsigned he
static bool rpi_alive(void *data)
{
(void)data;
return true;
return !rpi_shutdown;
}
static bool rpi_focus(void *data)

View File

@ -204,10 +204,8 @@ static void *linuxraw_input_init(void)
signal(SIGBUS, linuxraw_exitGracefully);
signal(SIGFPE, linuxraw_exitGracefully);
signal(SIGILL, linuxraw_exitGracefully);
signal(SIGINT, linuxraw_exitGracefully);
signal(SIGQUIT, linuxraw_exitGracefully);
signal(SIGSEGV, linuxraw_exitGracefully);
signal(SIGTERM, linuxraw_exitGracefully);
atexit(linuxraw_resetKbmd);