From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O1DgP-0001Db-LX for qemu-devel@nongnu.org; Mon, 12 Apr 2010 03:03:45 -0400 Received: from [140.186.70.92] (port=47817 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O1DgL-0001CP-Cb for qemu-devel@nongnu.org; Mon, 12 Apr 2010 03:03:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O1DgJ-0001PW-VD for qemu-devel@nongnu.org; Mon, 12 Apr 2010 03:03:41 -0400 Received: from mail-vw0-f45.google.com ([209.85.212.45]:54052) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O1DgJ-0001PQ-Qh for qemu-devel@nongnu.org; Mon, 12 Apr 2010 03:03:39 -0400 Received: by vws8 with SMTP id 8so2463304vws.4 for ; Mon, 12 Apr 2010 00:03:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4BC2C5C4.3030509@redhat.com> Date: Mon, 12 Apr 2010 09:03:32 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [Patch] Simplify cpu_can_run() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jun Koi Cc: qemu-devel@nongnu.org On 04/12/2010 08:24 AM, Jun Koi wrote: > diff --git a/cpus.c b/cpus.c > index 0debe77..4adb66d 100644 > --- a/cpus.c > +++ b/cpus.c > @@ -98,9 +98,7 @@ static void do_vm_stop(int reason) > > static int cpu_can_run(CPUState *env) > { > - if (env->stop) > - return 0; > - if (env->stopped || !vm_running) > + if (env->stop || env->stopped || !vm_running) > return 0; > return 1; > } I left it this way on purpose to help comparison with cpu_has_work. static int cpu_can_run(CPUState *env) { if (env->stop) return 0; if (env->stopped || !vm_running) return 0; return 1; } static int cpu_has_work(CPUState *env) { if (env->stop) return 1; if (env->stopped || !vm_running) return 0; Paolo