From patchwork Fri Dec 28 06:00:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Fix semaphores fallback code From: Brad X-Patchwork-Id: 208414 Message-Id: <20121228060022.GB27232@rox.home.comstyle.com> To: qemu-devel@nongnu.org Date: Fri, 28 Dec 2012 01:00:26 -0500 As reported in bug 1087114 the semaphores fallback code is broken which results in QEMU crashing and making QEMU unusable. This patch is from Paolo. This needs to be back ported to the 1.3 stable tree as well. Signed-off-by: Paolo Bonzini Signed-off-by: Brad Smith diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 7be292e..17f2d7c 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -213,6 +213,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms) while (sem->count < 0) { rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); if (rc == ETIMEDOUT) { + ++sem->count; break; } if (rc != 0) {