summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2018-06-26 16:39:53 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-28 18:08:45 +0200
commit1b18a4e67971486e2c8a6df1dfdc0a3b459d5608 (patch)
treed50cdbfe2bc5224e6a31d6ce4dda07f3ceee6a4b
parent4987fd4ab839a4d2acbcf63c056eade681aa92bd (diff)
downloadefl-1b18a4e67971486e2c8a6df1dfdc0a3b459d5608.tar.gz
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
-rw-r--r--src/lib/eio/eio_monitor_poll.c19
1 files 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;
}