summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-05 15:01:02 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2018-01-05 15:04:05 +0900
commit76b837002eaea56b5ecb174bffe284012084dc74 (patch)
treec59c893e91dfeee9d0e6d9f70a79a07d1f8fb9e1
parent4717f358daee9dbab76f6f9e4a07511a1883ef1a (diff)
efl loop - provide efl namespace versions of begin/end locks on mainloop
add efl_main_loop_steal() and efl_main_loop_release() for new efl namespace versiosn of ecore_thread_main_loop_begin() and ecore_thread_main_loop_end().
-rw-r--r--src/lib/ecore/Ecore_Eo.h26
-rw-r--r--src/lib/ecore/efl_loop.c12
2 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index f121380f2b..d1da269f30 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -113,6 +113,32 @@ EAPI Eina_Promise *efl_loop_main_promise_new(Eina_Promise_Cancel_Cb cancel_cb, c
113/* We ue the factory pattern here, so you shouldn't call eo_add directly. */ 113/* We ue the factory pattern here, so you shouldn't call eo_add directly. */
114EAPI Eo *efl_main_loop_get(void); 114EAPI Eo *efl_main_loop_get(void);
115 115
116/**
117 * Sync with main loop and lock it out and begin a mainloop eo context
118 *
119 * @result The number of time ecore_thread_main_loop_begin() has been called
120 * in this thread. If not, it returns @c -1.
121 *
122 * This function suspends the main loop in a safe state and then lets
123 * use any EFL call you want after it returns as if it were running in the
124 * main loop (except it's called from the calling thread). Be careful since
125 * the main loop is blocked until you call efl_main_loop_release(). This is
126 * the only sane way to achieve pseudo thread safety.
127 *
128 * Note that until the main loop is blocked, this function stalls until the
129 * main loop comes to a safe point to be paused.
130 */
131EAPI int efl_main_loop_steal(void);
132
133/* Release a main loop lock taken by efl_main_loop_steal()
134 *
135 * @result The number of times efl_main_loop_release() needs to be called
136 * before the main loop is unlocked again. @c -1 will be returned if you
137 * are trying to unlock when no matching call to efl_main_loop_steal() was
138 * made by this thread.
139 */
140EAPI int efl_main_loop_release(void);
141
116typedef struct _Efl_Future_Composite_Progress Efl_Future_All_Progress; 142typedef struct _Efl_Future_Composite_Progress Efl_Future_All_Progress;
117 143
118struct _Efl_Future_Composite_Progress 144struct _Efl_Future_Composite_Progress
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index cbd656e9b8..9a09a16c1d 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -66,6 +66,18 @@ efl_main_loop_get(void)
66 return efl_loop_main_get(EFL_LOOP_CLASS); 66 return efl_loop_main_get(EFL_LOOP_CLASS);
67} 67}
68 68
69EAPI int
70efl_main_loop_steal(void)
71{
72 return ecore_thread_main_loop_begin();
73}
74
75EAPI int
76efl_main_loop_release(void)
77{
78 return ecore_thread_main_loop_end();
79}
80
69EOLIAN static void 81EOLIAN static void
70_efl_loop_iterate(Eo *obj, Efl_Loop_Data *pd) 82_efl_loop_iterate(Eo *obj, Efl_Loop_Data *pd)
71{ 83{