Commit 514f7a277473a79fd42303f128379792a4667e65

Authored by malc
1 parent a8227a5a

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

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6634 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 1 additions and 1 deletions
posix-aio-compat.c
... ... @@ -104,7 +104,7 @@ static void *aio_thread(void *unused)
104 104 ret = cond_timedwait(&cond, &lock, &ts);
105 105 }
106 106  
107   - if (ret == ETIMEDOUT)
  107 + if (TAILQ_EMPTY(&request_list))
108 108 break;
109 109  
110 110 aiocb = TAILQ_FIRST(&request_list);
... ...