[01/21] Fix semaphores fallback code

Submitted by Michael Roth on Jan. 16, 2013, 4:49 p.m.

Details

Message ID 1358354963-9070-2-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Jan. 16, 2013, 4:49 p.m.
From: Brad Smith <brad@comstyle.com>

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 |    1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c
index 4ef9c7b..9a3885f 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) {