raster pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=c012e6939c76cac70cad32944603a42301ba0afa

commit c012e6939c76cac70cad32944603a42301ba0afa
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Wed Aug 13 17:36:00 2014 +0900

    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

-- 


Reply via email to