From: Sasha Levin Date: Sat, 30 Apr 2011 13:30:23 +0000 (+0300) Subject: kvm tools: Lock job_mutex before signalling X-Git-Tag: next-20110824~3^2~374 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=58d3cc0912c50aa7cb20e20ca445ad7a567b339f;p=karo-tx-linux.git kvm tools: Lock job_mutex before signalling Locking mutex before signalling to prevent unexpected scheduling. Signed-off-by: Sasha Levin Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/threadpool.c b/tools/kvm/threadpool.c index 25d9aad1d5a2..2db0218413d0 100644 --- a/tools/kvm/threadpool.c +++ b/tools/kvm/threadpool.c @@ -166,5 +166,7 @@ void thread_pool__do_job(void *job) thread_pool__job_push_locked(job); mutex_unlock(&jobinfo->mutex); + mutex_lock(&job_mutex); pthread_cond_signal(&job_cond); + mutex_unlock(&job_mutex); }