bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1b18a4e67971486e2c8a6df1dfdc0a3b459d5608
commit 1b18a4e67971486e2c8a6df1dfdc0a3b459d5608 Author: Mike Blumenkrantz <[email protected]> Date: Tue Jun 26 16:39:53 2018 -0400 eio/fallback: fix fallback shutdown when threads exist threads should not be waited on here during shutdown since these same threads may be waiting on the main loop anyway instead, perform as much deallocation as possible, mark the monitor as deleted, and then set the thread to canceled and allow the thread to clean itself up during its cancel/end callback @fix Differential Revision: https://phab.enlightenment.org/D6440 --- src/lib/eio/eio_monitor_poll.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/lib/eio/eio_monitor_poll.c b/src/lib/eio/eio_monitor_poll.c index ec0a2031d3..45e3281615 100644 --- a/src/lib/eio/eio_monitor_poll.c +++ b/src/lib/eio/eio_monitor_poll.c @@ -220,6 +220,14 @@ _eio_monitor_fallback_end_cb(void *data, Ecore_Thread *thread EINA_UNUSED) Eio_Monitor_Backend *backend = data; backend->work = NULL; + if (backend->delete_me) + { + eina_hash_free(backend->children); + free(backend); + return; + } + /* indicates eio shutdown is in progress */ + if (!timer_hash) return; backend->timer = ecore_timer_add(fallback_interval, _eio_monitor_fallback_timer_cb, backend); eina_hash_set(timer_hash, &backend, backend->timer); } @@ -232,9 +240,12 @@ _eio_monitor_fallback_cancel_cb(void *data, Ecore_Thread *thread EINA_UNUSED) backend->work = NULL; if (backend->delete_me) { + eina_hash_free(backend->children); free(backend); return; } + /* indicates eio shutdown is in progress */ + if (!timer_hash) return; backend->timer = ecore_timer_add(fallback_interval, _eio_monitor_fallback_timer_cb, backend); eina_hash_set(timer_hash, &backend, backend->timer); } @@ -338,18 +349,16 @@ eio_monitor_fallback_del(Eio_Monitor *monitor) monitor->backend = NULL; if (!backend) return; + backend->delete_me = EINA_TRUE; - if (backend->work) ecore_thread_cancel(backend->work); if (backend->timer) ecore_timer_del(backend->timer); eina_hash_set(timer_hash, &backend, NULL); backend->timer = NULL; - if (backend->idler) ecore_idler_del(backend->idler); - backend->idler = NULL; - if (backend->work && !ecore_thread_wait(backend->work, 0.3)) + if (backend->work) { - backend->delete_me = EINA_TRUE; + ecore_thread_cancel(backend->work); return; } --
