]> xenbits.xensource.com Git - qemu-upstream-4.5-testing.git/commitdiff
Fix semaphores fallback code
authorBrad Smith <brad@comstyle.com>
Fri, 28 Dec 2012 06:00:26 +0000 (01:00 -0500)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 14 Jan 2013 21:36:28 +0000 (15:36 -0600)
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 <pbonzini@redhat.com>
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit a795ef8dcb8cbadffc996c41ff38927a97645234)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
qemu-thread-posix.c

index 4ef9c7b3f83469c87d09b66751ceb2e67e7877e1..9a3885f94317d671ae460e4a3ffec44340fbeff5 100644 (file)
@@ -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) {