From patchwork Wed May 16 10:16:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Dovgalyuk X-Patchwork-Id: 159570 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 766CDB6FD7 for ; Wed, 16 May 2012 20:16:31 +1000 (EST) Received: from localhost ([::1]:53521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUbHR-0004KY-0m for incoming@patchwork.ozlabs.org; Wed, 16 May 2012 06:16:29 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUbHF-0004JU-Nm for qemu-devel@nongnu.org; Wed, 16 May 2012 06:16:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SUbH8-0000ue-82 for qemu-devel@nongnu.org; Wed, 16 May 2012 06:16:17 -0400 Received: from mail.ispras.ru ([83.149.199.43]:60671) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SUbH8-0000uR-0M for qemu-devel@nongnu.org; Wed, 16 May 2012 06:16:10 -0400 Received: from PASHAISP (unknown [80.250.189.177]) by mail.ispras.ru (Postfix) with ESMTP id 0FA9024FE71; Wed, 16 May 2012 14:16:08 +0400 (MSK) From: "Pavel Dovgaluk" To: "'dunrong huang'" References: <4fb35a7e.2458b40a.3ed6.649cSMTPIN_ADDED@mx.google.com> In-Reply-To: Date: Wed, 16 May 2012 14:16:07 +0400 Message-ID: <001001cd334c$e8d95260$ba8bf720$@Dovgaluk@ispras.ru> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac0zPMIIN+73wFcATp2PtaNjR8S6nQAD8amw Content-Language: ru X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 83.149.199.43 Cc: 'qemu-devel' Subject: Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org I use qemu under Windows and it has two windows when executes - console and SDL ones. When I close SDL window main loop function terminates correctly, and when I close console window to terminate qemu then the code after main loop is not executed. Pavel Dovgaluk From: dunrong huang [mailto:riegamaths@gmail.com] Sent: Wednesday, May 16, 2012 12:17 PM To: Pavel Dovgaluk Cc: qemu-devel Subject: Re: [Qemu-devel] [PATCH] Prevent disk data loss when closing qemu What's the difference of these two method to call bdrv_close_all? If you close qemu window, the main_loop will return immediately, and call bdrv_close_all. 2012/5/16 Pavel Dovgaluk Prevent disk data loss when closing qemu window. Signed-off-by: Pavel Dovgalyuk ---  vl.c |    2 +-  1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index 23ab3a3..b6cfd29 100644 --- a/vl.c +++ b/vl.c @@ -3650,10 +3650,10 @@ int main(int argc, char **argv, char **envp)     }     os_setup_post(); +    atexit(bdrv_close_all);     resume_all_vcpus();     main_loop(); -    bdrv_close_all();     pause_all_vcpus();     net_cleanup();     res_free();