raster pushed a commit to branch efl-1.13.

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

commit 02cda8633e83ea3832b3898a93750fe9a0927a37
Author: Carsten Haitzler (Rasterman) <ras...@rasterman.com>
Date:   Thu Feb 26 19:45:53 2015 +0900

    eina + ecore - fix main loop thread id tracking on fork
    
    if you fork and even if you do ecore_fork_reset() a thread calling
    ecore_main_loop_thread_safe_call_async(0 for example eill end up
    resetting the mainloop thread id to itself (a non mainlopo thread) via
    calling eina_main_loop_is() since pid changed. there is little point
    in doing this so remove the pid tracking from eina and ensure mainloop
    thread id is updated in ecore's fork reset.
    
    @fix
---
 src/lib/ecore/ecore.c    |  1 +
 src/lib/eina/eina_main.c | 31 +------------------------------
 2 files changed, 2 insertions(+), 30 deletions(-)

diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 0e48584..298e685 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -486,6 +486,7 @@ ecore_fork_reset(void)
    Eina_List *l, *ln;
    Ecore_Fork_Cb *fcb;
    
+   eina_main_loop_define();
    eina_lock_take(&_thread_safety);
 
    ecore_pipe_del(_thread_call);
diff --git a/src/lib/eina/eina_main.c b/src/lib/eina/eina_main.c
index d4edb24..236e0b7 100644
--- a/src/lib/eina/eina_main.c
+++ b/src/lib/eina/eina_main.c
@@ -108,7 +108,6 @@ EAPI DWORD _eina_main_loop;
 # else
 EAPI pthread_t _eina_main_loop;
 # endif
-static pid_t _eina_pid;
 #endif
 
 #ifdef MT
@@ -285,7 +284,6 @@ eina_init(void)
 # else
    _eina_main_loop = pthread_self();
 # endif
-   _eina_pid = getpid();
 #endif
 
 #ifdef EINA_HAVE_DEBUG_THREADS
@@ -425,35 +423,9 @@ EAPI Eina_Bool
 eina_main_loop_is(void)
 {
 #ifdef EFL_HAVE_THREADS
-  pid_t pid;
-
-# ifdef _WIN32
-   if (_eina_main_loop == GetCurrentThreadId())
-     return EINA_TRUE;
-# else
-   if (pthread_equal(_eina_main_loop, pthread_self()))
+  if (pthread_equal(_eina_main_loop, pthread_self()))
      return EINA_TRUE;
-# endif
-
-   pid = getpid();
-# ifdef _WIN32
-   if (pid != _eina_pid)
-     {
-        _eina_pid = pid;
-        _eina_main_loop = GetCurrentThreadId();
-        return EINA_TRUE;
-     }
-#else
-   if (pid != _eina_pid)
-     {
-        /* This is in case of a fork, but don't like the solution */
-        _eina_pid = pid;
-        _eina_main_loop = pthread_self();
-        return EINA_TRUE;
-     }
-#endif
 #endif
-
    return EINA_FALSE;
 }
 
@@ -462,7 +434,6 @@ EAPI void
 eina_main_loop_define(void)
 {
 #ifdef EFL_HAVE_THREADS
-   _eina_pid = getpid();
 # ifdef _WIN32
    _eina_main_loop = GetCurrentThreadId();
 # else

-- 


Reply via email to