From: Pekka Enberg Subject: [PATCH] kvm tools: Stop guest if SDL window is closed Date: Wed, 10 Aug 2011 21:50:25 +0300 Message-ID: <1313002225-6312-1-git-send-email-penberg@kernel.org> Cc: Pekka Enberg , Asias He , Cyrill Gorcunov , Ingo Molnar , Prasad Joshi , Sasha Levin To: kvm@vger.kernel.org Return-path: Received: from filtteri2.pp.htv.fi ([213.243.153.185]:44636 "EHLO filtteri2.pp.htv.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753878Ab1HJSu1 (ORCPT ); Wed, 10 Aug 2011 14:50:27 -0400 Sender: kvm-owner@vger.kernel.org List-ID: Send SIGKVMSTOP signal to the process if the SDL window is closed. This fixes an annoying problem where closing the window makes the guest seem like it froze although it's really running in the background but the UI is unusable. Cc: Asias He Cc: Cyrill Gorcunov Cc: Ingo Molnar Cc: Prasad Joshi Cc: Sasha Levin Signed-off-by: Pekka Enberg --- tools/kvm/ui/sdl.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/tools/kvm/ui/sdl.c b/tools/kvm/ui/sdl.c index aa3eff9..088cd29 100644 --- a/tools/kvm/ui/sdl.c +++ b/tools/kvm/ui/sdl.c @@ -3,9 +3,11 @@ #include "kvm/framebuffer.h" #include "kvm/i8042.h" #include "kvm/util.h" +#include "kvm/kvm.h" #include #include +#include #define FRAME_RATE 25 @@ -127,6 +129,8 @@ static void *sdl__thread(void *p) SDL_Delay(1000 / FRAME_RATE); } exit: + kill(0, SIGKVMSTOP); + return NULL; } -- 1.7.0.4