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 <pbonzini@redhat.com>
Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit a795ef8dcb)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
This commit is contained in:
Brad Smith 2012-12-28 01:00:26 -05:00 committed by Michael Roth
parent 6d6c9f59ca
commit 0a7ad69a0f
1 changed files with 1 additions and 0 deletions

View File

@ -213,6 +213,7 @@ int qemu_sem_timedwait(QemuSemaphore *sem, int ms)
while (sem->count < 0) { while (sem->count < 0) {
rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts); rc = pthread_cond_timedwait(&sem->cond, &sem->lock, &ts);
if (rc == ETIMEDOUT) { if (rc == ETIMEDOUT) {
++sem->count;
break; break;
} }
if (rc != 0) { if (rc != 0) {