summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad Smith2012-12-28 07:00:26 +0100
committerBlue Swirl2012-12-29 13:27:36 +0100
commita795ef8dcb8cbadffc996c41ff38927a97645234 (patch)
tree8b0e9d3368a50e3762d208965f0cf78de01fc33f
parenttcg-hppa: Fix typo in brcond2 (diff)
downloadqemu-a795ef8dcb8cbadffc996c41ff38927a97645234.tar.gz
qemu-a795ef8dcb8cbadffc996c41ff38927a97645234.tar.xz
qemu-a795ef8dcb8cbadffc996c41ff38927a97645234.zip
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>
-rw-r--r--qemu-thread-posix.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/qemu-thread-posix.c b/qemu-thread-posix.c
index 6374df3328..4489abf1d8 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) {