summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-12-15 17:44:28 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-12-18 19:54:31 +0900
commit5dbfb7961f738245cceb144123cee207a1d65d55 (patch)
treef548022cc07c3383e381914e70544bc874785e8f /src/lib
parent9427862d4010572a1c905fbcdd42a300751f8aa1 (diff)
eo/eina: Add HACK to avoid calls to EO after shutdown
Efl.Future is an EO object which means even cancelling Efl.Future objects requires EO. So this should be done before shutting down EO, otherwise everything fails badly. I believe Efl.Future is going to disappear soon, but the problem will remain: if any promise/future uses EO or anything else outside of Eina (so, basically anything) then it needs to be canceled before shutting down the above layers. This is the same situation as with ecore events, for which we've introduced ecore_event_type_flush. Ping @cedric
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/eina/eina_promise.c9
-rw-r--r--src/lib/eina/eina_promise.h8
-rw-r--r--src/lib/eo/efl_future.c1
3 files changed, 17 insertions, 1 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c
index 649b6e97b0..7e7617ceb7 100644
--- a/src/lib/eina/eina_promise.c
+++ b/src/lib/eina/eina_promise.c
@@ -532,10 +532,17 @@ eina_promise_init(void)
532 return EINA_FALSE; 532 return EINA_FALSE;
533} 533}
534 534
535EAPI void
536__eina_promise_cancel_all(void)
537{
538 while (_pending_futures)
539 _eina_future_cancel(_pending_futures->data, ECANCELED);
540}
541
535Eina_Bool 542Eina_Bool
536eina_promise_shutdown(void) 543eina_promise_shutdown(void)
537{ 544{
538 while (_pending_futures) _eina_future_cancel(_pending_futures->data, ECANCELED); 545 __eina_promise_cancel_all();
539 eina_mempool_del(_future_mp); 546 eina_mempool_del(_future_mp);
540 eina_mempool_del(_promise_mp); 547 eina_mempool_del(_promise_mp);
541 eina_log_domain_unregister(_promise_log_dom); 548 eina_log_domain_unregister(_promise_log_dom);
diff --git a/src/lib/eina/eina_promise.h b/src/lib/eina/eina_promise.h
index 44e9aef655..41778c54a6 100644
--- a/src/lib/eina/eina_promise.h
+++ b/src/lib/eina/eina_promise.h
@@ -1736,6 +1736,14 @@ eina_future_race_array(Eina_Future *array[])
1736 */ 1736 */
1737#define eina_future_chain_easy(_prev, ...) eina_future_chain_easy_array(_prev, (Eina_Future_Cb_Easy_Desc[]) {__VA_ARGS__, {NULL, NULL, NULL, NULL, NULL}}) 1737#define eina_future_chain_easy(_prev, ...) eina_future_chain_easy_array(_prev, (Eina_Future_Cb_Easy_Desc[]) {__VA_ARGS__, {NULL, NULL, NULL, NULL, NULL}})
1738 1738
1739/**
1740 * @brief Cancels all pending promise/futures.
1741 *
1742 * Internal function. Do not use.
1743 *
1744 * @internal
1745 */
1746EAPI void __eina_promise_cancel_all(void);
1739 1747
1740/** 1748/**
1741 * @} 1749 * @}
diff --git a/src/lib/eo/efl_future.c b/src/lib/eo/efl_future.c
index aaa1d88a51..8f19a34e11 100644
--- a/src/lib/eo/efl_future.c
+++ b/src/lib/eo/efl_future.c
@@ -52,5 +52,6 @@ efl_future_init(void)
52Eina_Bool 52Eina_Bool
53efl_future_shutdown(void) 53efl_future_shutdown(void)
54{ 54{
55 __eina_promise_cancel_all();
55 return EINA_TRUE; 56 return EINA_TRUE;
56} 57}