Skip to contentSkip to conversation

[6634] Properly handle pthread_cond_timedwait timing out

Qemu-devel malc 1 participant 1 message Feb 21, 2009

lore
Share & tools
lore

malc

author
#0 lore raw

Revision: 6634

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6634
Author:   malc
Date:     2009-02-21 05:48:19 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
Properly handle pthread_cond_timedwait timing out

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

Modified Paths:
--------------
trunk/posix-aio-compat.c

Modified: trunk/posix-aio-compat.c
===================================================================

posix-aio-compat.c +1 -1
@@ -104,7 +104,7 @@
             ret = cond_timedwait(&cond, &lock, &ts);
         }
 
-        if (ret == ETIMEDOUT)
+        if (TAILQ_EMPTY(&request_list))
             break;
 
         aiocb = TAILQ_FIRST(&request_list);