summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-02 08:50:54 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-04-02 08:50:54 -0400
commit2647d931772ebe444ce55295e4214deb8b35e947 (patch)
tree183bfd560a7a7b3f8857b6885ee041aaee8693b3 /src/lib/ecore
parent43a522b8767dce5ceabc40cd6868f7fba65f0abc (diff)
ecore: correctly clean up in ecore_fork_reset
Summary: after a fork does happen, the new process does not have any self created threads at all. However, _thread_cb can contain suspend calls of ecore_thread_main_loop_begin. _ecore_main_call_flush will then wait in the suspend block for the thread to call ecore_thread_main_loop_end. However, the thread is dead, the end function will never be called. Hence we should ensure that we definitly kill every entry in _thread_cb that has a susped flag on true. This fixes deadlocks while running the testsuites with EIO_MONITOR_POLL=1 Depends on D8526 Reviewers: cedric, segfaultxavi, zmike Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8531
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/ecore.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 1c8c6ec960..ceb3021019 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -571,10 +571,13 @@ ecore_fork_reset(void)
571 571
572 EINA_LIST_FOREACH_SAFE(_thread_cb, l, ln, call) 572 EINA_LIST_FOREACH_SAFE(_thread_cb, l, ln, call)
573 { 573 {
574 if (call->suspend || call->sync) continue; 574 //if something is supsend, then the mainloop will be blocked until until thread is calling ecore_thread_main_loop_end()
575 if (call->cb.async != (Ecore_Cb)&_ecore_thread_join) continue; 575 //if something tries to join a thread as callback, ensure that we remove this
576 _thread_cb = eina_list_remove_list(_thread_cb, l); 576 if (call->suspend || (call->cb.async == (Ecore_Cb)&_ecore_thread_join))
577 free(call); 577 {
578 _thread_cb = eina_list_remove_list(_thread_cb, l);
579 free(call);
580 }
578 } 581 }
579 if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int)); 582 if (_thread_cb) ecore_pipe_write(_thread_call, &wakeup, sizeof (int));
580 } 583 }
@@ -686,7 +689,7 @@ ecore_thread_main_loop_begin(void)
686 return ++_thread_loop; 689 return ++_thread_loop;
687 } 690 }
688 691
689 order = malloc(sizeof (Ecore_Safe_Call)); 692 order = calloc(1, sizeof (Ecore_Safe_Call));
690 if (!order) return -1; 693 if (!order) return -1;
691 694
692 eina_lock_take(&_thread_id_lock); 695 eina_lock_take(&_thread_id_lock);