From: Brad Smith Date: Fri, 28 Dec 2012 06:00:26 +0000 (-0500) Subject: Fix semaphores fallback code X-Git-Tag: qemu-xen-4.3.0~6^2~29 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0a7ad69a0f012d5d70142f775f99405500d4d38e;p=qemu-upstream-4.4-testing.git Fix semaphores fallback code 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 Signed-off-by: Blue Swirl (cherry picked from commit a795ef8dcb8cbadffc996c41ff38927a97645234) Signed-off-by: Michael Roth --- diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c index 4ef9c7b3f..9a3885f94 100644 --- a/qemu-thread-posix.c +++ b/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) {