eina thread queue - fix possible deadlock

coverity pointed out a deadlock - CID 1226193. i hope this fixes it
(need to wait days for a coverity re-run). tests pass and real life
usage works, so i assume its ok. in theory i see no problem either.
This commit is contained in:
Carsten Haitzler 2014-08-13 17:36:00 +09:00
parent 970968daab
commit c012e6939c
1 changed files with 1 additions and 4 deletions

View File

@ -454,14 +454,11 @@ eina_thread_queue_poll(Eina_Thread_Queue *thq, void **allocref)
RWLOCK_LOCK(&(thq->lock_read));
msg = _eina_thread_queue_msg_fetch(thq, &blk);
RWLOCK_UNLOCK(&(thq->lock_read));
if (msg)
{
_eina_thread_queue_wait(thq);
*allocref = blk;
}
RWLOCK_UNLOCK(&(thq->lock_read));
if (msg)
{
#ifdef ATOMIC
__atomic_sub_fetch(&(thq->pending), 1, __ATOMIC_RELAXED);
#else