raster pushed a commit to branch master.

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

commit 8fd224b4d665ff420c9d803eec9d9e5b449ed503
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Fri Aug 5 17:38:02 2016 +0900

    eina thread queue/semaphores - check even more unlikely errors + complain
    
    check some really unlikely alloc errors and semaphore deadlock errors
    and report if that has happened. just in case.
---
 src/lib/eina/eina_inline_lock_posix.x |  6 +++++-
 src/lib/eina/eina_thread_queue.c      | 12 ++++++++++--
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/lib/eina/eina_inline_lock_posix.x 
b/src/lib/eina/eina_inline_lock_posix.x
index 58194e5..c28a2d0 100644
--- a/src/lib/eina/eina_inline_lock_posix.x
+++ b/src/lib/eina/eina_inline_lock_posix.x
@@ -888,7 +888,11 @@ eina_semaphore_lock(Eina_Semaphore *sem)
         else
           {
              if (errno != EINTR)
-               break;
+               {
+                  if (errno == EDEADLK)
+                    EINA_LOCK_DEADLOCK_DEBUG(sem_wait, sem);
+                  break;
+               }
           }
      }
    return ok;
diff --git a/src/lib/eina/eina_thread_queue.c b/src/lib/eina/eina_thread_queue.c
index 6bf0c53..190d772 100644
--- a/src/lib/eina/eina_thread_queue.c
+++ b/src/lib/eina/eina_thread_queue.c
@@ -116,7 +116,11 @@ _eina_thread_queue_msg_block_new(int size)
    blk = malloc(sizeof(Eina_Thread_Queue_Msg_Block) -
                 sizeof(Eina_Thread_Queue_Msg) +
                 size);
-   if (!blk) return NULL;
+   if (!blk)
+     {
+        ERR("Thread queue block buffer of size %i allocation failed", size);
+        return NULL;
+     }
    blk->next = NULL;
 #ifndef ATOMIC
    eina_spinlock_new(&(blk->lock_ref));
@@ -380,7 +384,11 @@ eina_thread_queue_new(void)
    Eina_Thread_Queue *thq;
 
    thq = calloc(1, sizeof(Eina_Thread_Queue));
-   if (!thq) return NULL;
+   if (!thq)
+     {
+        ERR("Allocation of Thread queue structure failed");
+        return NULL;
+     }
    thq->fd = -1;
    if (!eina_semaphore_new(&(thq->sem), 0))
      {

-- 


Reply via email to