Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > aadbe78a25743146bb784eee19f007c5 > files > 162

kvm-83-164.el5_5.9.src.rpm

From 59493b082bd0b33f6ae7f7adeba19d00b8ad7280 Mon Sep 17 00:00:00 2001
From: Eduardo Habkost <ehabkost@redhat.com>
Date: Thu, 24 Sep 2009 16:56:48 -0300
Subject: [PATCH 2/3] Properly handle pthread_cond_timedwait timing out

RH-Author: Gleb Natapov <gleb@redhat.com>
Message-id: <20090923131722.GA23157@redhat.com>
Patchwork-id: 3510
O-Subject: [PATCH] Properly handle pthread_cond_timedwait timing out
Bugzilla: 525114
RH-Acked-by: Avi Kivity <avi@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
RH-Acked-by: Juan Quintela <quintela@redhat.com>

pthread_cond_timedwait is allowed to both consume the signal and
return with the value indicating the timeout, hence predicate should
always be (re)checked before taking an action

BZ: 525114
Upstream status: commit  514f7a27747

Signed-off-by: Gleb Natapov <gleb@redhat.com>
--
			Gleb.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 qemu/posix-aio-compat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/qemu/posix-aio-compat.c b/qemu/posix-aio-compat.c
index c919e3b..394e807 100644
--- a/qemu/posix-aio-compat.c
+++ b/qemu/posix-aio-compat.c
@@ -52,7 +52,7 @@ static void *aio_thread(void *unused)
             ret = pthread_cond_timedwait(&cond, &lock, &ts);
         }
 
-        if (ret == ETIMEDOUT)
+        if (TAILQ_EMPTY(&request_list))
             break;
 
         aiocb = TAILQ_FIRST(&request_list);
-- 
1.6.3.rc4.29.g8146