diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2015-06-09 19:36:59 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2015-06-09 19:39:01 +0900 |
commit | 0e8d1c8485a572b4070e7bacd1b4e7e6ddb1b8f2 (patch) | |
tree | 9614fd2c9ea73da806941ae9aac4316d489e6eaa /src/lib/eina/eina_inline_lock_posix.x | |
parent | f153cad879eaeb986556c12aac0a4d6e2498732c (diff) |
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.
Diffstat (limited to '')
-rw-r--r-- | src/lib/eina/eina_inline_lock_posix.x | 21 |
1 files 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 6abbace0d1..b1718a8853 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) | |||
784 | static inline Eina_Bool | 784 | static inline Eina_Bool |
785 | eina_semaphore_lock(Eina_Semaphore *sem) | 785 | eina_semaphore_lock(Eina_Semaphore *sem) |
786 | { | 786 | { |
787 | Eina_Bool ok = EINA_FALSE; | ||
788 | |||
787 | if (!sem) | 789 | if (!sem) |
788 | return EINA_FALSE; | 790 | return EINA_FALSE; |
789 | 791 | ||
792 | for (;;) | ||
793 | { | ||
794 | if ( | ||
790 | #if defined(EINA_HAVE_OSX_SEMAPHORE) | 795 | #if defined(EINA_HAVE_OSX_SEMAPHORE) |
791 | return (sem_wait(sem->sema) == 0) ? EINA_TRUE : EINA_FALSE; | 796 | sem_wait(sem->sema) |
792 | #else | 797 | #else |
793 | return (sem_wait(sem) == 0) ? EINA_TRUE : EINA_FALSE; | 798 | sem_wait(sem) |
794 | #endif | 799 | #endif |
800 | == 0) | ||
801 | { | ||
802 | ok = EINA_TRUE; | ||
803 | break; | ||
804 | } | ||
805 | else | ||
806 | { | ||
807 | if (errno != EINTR) | ||
808 | break; | ||
809 | } | ||
810 | } | ||
811 | return ok; | ||
795 | } | 812 | } |
796 | 813 | ||
797 | static inline Eina_Bool | 814 | static inline Eina_Bool |