Received: from [140.186.70.92] (port=40349 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmrnm-00040l-8h for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:56:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pmrnl-0006kT-1I for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:56:34 -0500 Received: from mail-yx0-f173.google.com ([209.85.213.173]:35007) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmrDP-0000yI-Dd for qemu-devel@nongnu.org; Tue, 08 Feb 2011 12:18:59 -0500 Received: by mail-yx0-f173.google.com with SMTP id 31so2641489yxl.4 for ; Tue, 08 Feb 2011 09:18:59 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 8 Feb 2011 18:18:28 +0100 Message-Id: <1297185509-20996-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1297185509-20996-1-git-send-email-pbonzini@redhat.com> References: <1297185509-20996-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [CFT PATCH 11/12] do not use timedwait on qemu_cpu_cond List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Whenever env->created becomes true, qemu_cpu_cond is signaled by {kvm,tcg}_cpu_thread_fn. I change qemu_cond_signal to qemu_cond_broadcast because right now there is only one listened but, if there were more, there would be no reason to wake up only one. Signed-off-by: Paolo Bonzini --- cpus.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpus.c b/cpus.c index 97ba166..67fd672 100644 --- a/cpus.c +++ b/cpus.c @@ -794,7 +794,7 @@ static void *kvm_cpu_thread_fn(void *arg) /* signal CPU creation */ env->created = 1; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_broadcast(&qemu_cpu_cond); /* and wait for machine initialization */ while (!qemu_system_ready) @@ -820,7 +820,7 @@ static void *tcg_cpu_thread_fn(void *arg) qemu_mutex_lock(&qemu_global_mutex); for (env = first_cpu; env != NULL; env = env->next_cpu) env->created = 1; - qemu_cond_signal(&qemu_cpu_cond); + qemu_cond_broadcast(&qemu_cpu_cond); /* and wait for machine initialization */ while (!qemu_system_ready) @@ -935,7 +935,7 @@ static void tcg_init_vcpu(void *_env) qemu_cond_init(env->halt_cond); qemu_thread_create(env->thread, tcg_cpu_thread_fn, env); while (env->created == 0) - qemu_cond_timedwait(&qemu_cpu_cond, &qemu_global_mutex, 100); + qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); tcg_cpu_thread = env->thread; tcg_halt_cond = env->halt_cond; } else { @@ -951,7 +951,7 @@ static void kvm_start_vcpu(CPUState *env) qemu_cond_init(env->halt_cond); qemu_thread_create(env->thread, kvm_cpu_thread_fn, env); while (env->created == 0) - qemu_cond_timedwait(&qemu_cpu_cond, &qemu_global_mutex, 100); + qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); } void qemu_init_vcpu(void *_env) -- 1.7.3.5