kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com,
	prasadjoshi124@gmail.com, kvm@vger.kernel.org,
	Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 1/3] kvm tools: Lock job_mutex before signalling
Date: Sat, 30 Apr 2011 16:30:23 +0300	[thread overview]
Message-ID: <1304170225-4859-1-git-send-email-levinsasha928@gmail.com> (raw)

Locking mutex before signalling to prevent unexpected
scheduling.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
 tools/kvm/threadpool.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/kvm/threadpool.c b/tools/kvm/threadpool.c
index c584ec7..700c08f 100644
--- a/tools/kvm/threadpool.c
+++ b/tools/kvm/threadpool.c
@@ -166,5 +166,7 @@ void thread_pool__signal_work(void *job)
 		thread_pool__job_info_push_locked(job);
 	mutex_unlock(&jobinfo->mutex);
 
+	mutex_lock(&job_mutex);
 	pthread_cond_signal(&job_cond);
+	mutex_unlock(&job_mutex);
 }
-- 
1.7.5.rc3


             reply	other threads:[~2011-04-30 13:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-30 13:30 Sasha Levin [this message]
2011-04-30 13:30 ` [PATCH 2/3] kvm tools: Introduce virtio-rng Sasha Levin
2011-05-05  6:54   ` Ingo Molnar
2011-05-05  7:09     ` Pekka Enberg
2011-05-05  7:12       ` Ingo Molnar
2011-05-05  7:14         ` Pekka Enberg
2011-05-05  7:20           ` Sasha Levin
2011-05-05 16:04           ` Sasha Levin
2011-05-05 22:00             ` Ingo Molnar
2011-05-05  7:14         ` Ingo Molnar
2011-04-30 13:30 ` [PATCH 3/3] kvm tools: Add cmdline switch to enable virtio-rng Sasha Levin
2011-05-01  7:10 ` [PATCH 1/3] kvm tools: Lock job_mutex before signalling Pekka Enberg
2011-05-01  7:43   ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304170225-4859-1-git-send-email-levinsasha928@gmail.com \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).