discomfitor pushed a commit to branch master.

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

commit 8f2b36b774d883ca2fa62741df1e2d3ed6dbaa69
Author: Mike Blumenkrantz <[email protected]>
Date:   Thu Jan 25 15:32:14 2018 -0500

    ecore: prune existing thread_join callbacks during ecore_fork_reset
    
    permitting these to persist and trigger at a later point will cause
    the process to deadlock while attempting to join non-existent threads
    
    @fix
---
 src/lib/ecore/ecore.c        | 16 +++++++++++++++-
 src/lib/ecore/ecore_thread.c |  2 +-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 586f3588a4..a2779bed86 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -68,6 +68,8 @@ static int _ecore_init_count_threshold = 0;
 int _ecore_log_dom = -1;
 int _ecore_fps_debug = 0;
 
+extern void (*_ecore_thread_join)();
+
 typedef struct _Ecore_Safe_Call Ecore_Safe_Call;
 struct _Ecore_Safe_Call
 {
@@ -577,7 +579,19 @@ ecore_fork_reset(void)
    ecore_pipe_del(_thread_call);
    _thread_call = ecore_pipe_add(_thread_callback, NULL);
    /* If there was something in the pipe, trigger a wakeup again */
-   if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
+   if (_thread_cb)
+     {
+        Ecore_Safe_Call *call;
+
+        EINA_LIST_FOREACH_SAFE(_thread_cb, l, ln, call)
+          {
+             if (call->suspend || call->sync) continue;
+             if (call->cb.async != (Ecore_Cb)&_ecore_thread_join) continue;
+             _thread_cb = eina_list_remove_list(_thread_cb, l);
+             free(call);
+          }
+        if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
+     }
 
    eina_lock_release(&_thread_safety);
 
diff --git a/src/lib/ecore/ecore_thread.c b/src/lib/ecore/ecore_thread.c
index abef08f4ad..2dc16ed389 100644
--- a/src/lib/ecore/ecore_thread.c
+++ b/src/lib/ecore/ecore_thread.c
@@ -208,7 +208,7 @@ _ecore_thread_data_free(void *data)
    free(d);
 }
 
-static void
+void
 _ecore_thread_join(PH(thread))
 {
    DBG("joining thread=%" PRIu64, (uint64_t)thread);

-- 


Reply via email to