raster pushed a commit to branch efl-1.14.

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

commit 25d4854114297df8021c01a68d8414be7e0c6dc5
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Tue Jun 9 19:36:59 2015 +0900

    eina semaphore lock - don't wake up because of signals
    
    @fix - this fixes eina sephamore lock/wait to not return just because
    of a signal sent to the process - try again if the semaphore wait is
    interrupted by a signal as opposed to a semaphore wakeup.
---
 src/lib/eina/eina_inline_lock_posix.x | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/lib/eina/eina_inline_lock_posix.x 
b/src/lib/eina/eina_inline_lock_posix.x
index 6abbace..b1718a8 100644
--- a/src/lib/eina/eina_inline_lock_posix.x
+++ b/src/lib/eina/eina_inline_lock_posix.x
@@ -784,14 +784,31 @@ eina_semaphore_free(Eina_Semaphore *sem)
 static inline Eina_Bool
 eina_semaphore_lock(Eina_Semaphore *sem)
 {
+   Eina_Bool ok = EINA_FALSE;
+
    if (!sem)
      return EINA_FALSE;
 
+   for (;;)
+     {
+        if (
 #if defined(EINA_HAVE_OSX_SEMAPHORE)
-   return (sem_wait(sem->sema) == 0) ? EINA_TRUE : EINA_FALSE;
+            sem_wait(sem->sema)
 #else
-   return (sem_wait(sem) == 0) ? EINA_TRUE : EINA_FALSE;
+            sem_wait(sem)
 #endif
+            == 0)
+          {
+             ok = EINA_TRUE;
+             break;
+          }
+        else
+          {
+             if (errno != EINTR)
+               break;
+          }
+     }
+   return ok;
 }
 
 static inline Eina_Bool

-- 


Reply via email to