mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
Handle terminating signals (Gerd Hoffmann)
This patch makes qemu handle signals better. It sets the request_shutdown flag, making the main_loop exit and qemu taking the usual exit route, with atexit handlers being called and so on, instead of qemu just being killed by the signal. To avoid calling vm_start() from the signal handler main_loop() got an additional check so qemu_system_shutdown_request() works even when the vm is in stopped state. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5055 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
6f382b5ec0
commit
5b08fc106d
3 changed files with 28 additions and 10 deletions
9
sdl.c
9
sdl.c
|
@ -476,10 +476,8 @@ static void sdl_refresh(DisplayState *ds)
|
|||
sdl_process_key(&ev->key);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
if (!no_quit) {
|
||||
if (!no_quit)
|
||||
qemu_system_shutdown_request();
|
||||
vm_start(); /* In case we're paused */
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
if (gui_grab || kbd_mouse_is_absolute() ||
|
||||
|
@ -636,11 +634,6 @@ void sdl_display_init(DisplayState *ds, int full_screen, int no_frame)
|
|||
fprintf(stderr, "Could not initialize SDL - exiting\n");
|
||||
exit(1);
|
||||
}
|
||||
#ifndef _WIN32
|
||||
/* NOTE: we still want Ctrl-C to work, so we undo the SDL redirections */
|
||||
signal(SIGINT, SIG_DFL);
|
||||
signal(SIGQUIT, SIG_DFL);
|
||||
#endif
|
||||
|
||||
ds->dpy_update = sdl_update;
|
||||
ds->dpy_resize = sdl_resize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue