From c012e6939c76cac70cad32944603a42301ba0afa Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Wed, 13 Aug 2014 17:36:00 +0900 Subject: [PATCH] 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. --- src/lib/eina/eina_thread_queue.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/eina/eina_thread_queue.c b/src/lib/eina/eina_thread_queue.c index d36669e..23ede13 100644 --- a/src/lib/eina/eina_thread_queue.c +++ b/src/lib/eina/eina_thread_queue.c @@ -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 -- 2.7.4