summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Ecore.am10
-rw-r--r--src/lib/ecore/Ecore_Eo.h3
-rw-r--r--src/lib/ecore/ecore_idle_exiter.c81
-rw-r--r--src/lib/ecore/ecore_idle_exiter.eo17
4 files changed, 49 insertions, 62 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 27ea8cdc1d..8e10b39a01 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -11,7 +11,9 @@ BUILT_SOURCES += \
11 lib/ecore/ecore_idler.eo.c \ 11 lib/ecore/ecore_idler.eo.c \
12 lib/ecore/ecore_idler.eo.h \ 12 lib/ecore/ecore_idler.eo.h \
13 lib/ecore/ecore_idle_enterer.eo.c \ 13 lib/ecore/ecore_idle_enterer.eo.c \
14 lib/ecore/ecore_idle_enterer.eo.h 14 lib/ecore/ecore_idle_enterer.eo.h \
15 lib/ecore/ecore_idle_exiter.eo.c \
16 lib/ecore/ecore_idle_exiter.eo.h
15 17
16ecoreeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@ 18ecoreeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
17ecoreeolianfiles_DATA = \ 19ecoreeolianfiles_DATA = \
@@ -19,7 +21,8 @@ ecoreeolianfiles_DATA = \
19 lib/ecore/ecore_poll.eo \ 21 lib/ecore/ecore_poll.eo \
20 lib/ecore/ecore_job.eo \ 22 lib/ecore/ecore_job.eo \
21 lib/ecore/ecore_idler.eo \ 23 lib/ecore/ecore_idler.eo \
22 lib/ecore/ecore_idle_enterer.eo 24 lib/ecore/ecore_idle_enterer.eo \
25 lib/ecore/ecore_idle_exiter.eo
23 26
24EXTRA_DIST += \ 27EXTRA_DIST += \
25 ${ecoreeolianfiles_DATA} 28 ${ecoreeolianfiles_DATA}
@@ -39,7 +42,8 @@ nodist_installed_ecoremainheaders_DATA = \
39 lib/ecore/ecore_poll.eo.h \ 42 lib/ecore/ecore_poll.eo.h \
40 lib/ecore/ecore_job.eo.h \ 43 lib/ecore/ecore_job.eo.h \
41 lib/ecore/ecore_idler.eo.h \ 44 lib/ecore/ecore_idler.eo.h \
42 lib/ecore/ecore_idle_enterer.eo.h 45 lib/ecore/ecore_idle_enterer.eo.h \
46 lib/ecore/ecore_idle_exiter.eo.h
43 47
44lib_ecore_libecore_la_SOURCES = \ 48lib_ecore_libecore_la_SOURCES = \
45lib/ecore/ecore.c \ 49lib/ecore/ecore.c \
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index 3491591191..fedacdfdbc 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -315,6 +315,8 @@ enum
315/** 315/**
316 * 316 *
317 */ 317 */
318#include "ecore_idle_exiter.eo.h"
319#if 0
318 320
319#define ECORE_IDLE_EXITER_CLASS ecore_idle_exiter_class_get() 321#define ECORE_IDLE_EXITER_CLASS ecore_idle_exiter_class_get()
320const Eo_Class *ecore_idle_exiter_class_get(void) EINA_CONST; 322const Eo_Class *ecore_idle_exiter_class_get(void) EINA_CONST;
@@ -341,6 +343,7 @@ enum
341 */ 343 */
342#define ecore_idle_exiter_constructor(func, data) ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data) 344#define ecore_idle_exiter_constructor(func, data) ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), EO_TYPECHECK(Ecore_Task_Cb, func), EO_TYPECHECK(const void *, data)
343 345
346#endif
344/** 347/**
345 * @} 348 * @}
346 */ 349 */
diff --git a/src/lib/ecore/ecore_idle_exiter.c b/src/lib/ecore/ecore_idle_exiter.c
index e18aacb039..bf9b015c36 100644
--- a/src/lib/ecore/ecore_idle_exiter.c
+++ b/src/lib/ecore/ecore_idle_exiter.c
@@ -13,9 +13,7 @@
13 13
14#define MY_CLASS_NAME "Ecore_Idle_Exiter" 14#define MY_CLASS_NAME "Ecore_Idle_Exiter"
15 15
16EAPI Eo_Op ECORE_IDLE_EXITER_BASE_ID = EO_NOOP; 16struct _Ecore_Idle_Exiter_Data
17
18struct _Ecore_Idle_Exiter_Private_Data
19{ 17{
20 EINA_INLIST; 18 EINA_INLIST;
21 Ecore_Idle_Exiter *obj; 19 Ecore_Idle_Exiter *obj;
@@ -25,10 +23,10 @@ struct _Ecore_Idle_Exiter_Private_Data
25 Eina_Bool delete_me : 1; 23 Eina_Bool delete_me : 1;
26}; 24};
27 25
28typedef struct _Ecore_Idle_Exiter_Private_Data Ecore_Idle_Exiter_Private_Data; 26typedef struct _Ecore_Idle_Exiter_Data Ecore_Idle_Exiter_Data;
29 27
30static Ecore_Idle_Exiter_Private_Data *idle_exiters = NULL; 28static Ecore_Idle_Exiter_Data *idle_exiters = NULL;
31static Ecore_Idle_Exiter_Private_Data *idle_exiter_current = NULL; 29static Ecore_Idle_Exiter_Data *idle_exiter_current = NULL;
32static int idle_exiters_delete_me = 0; 30static int idle_exiters_delete_me = 0;
33 31
34static void * 32static void *
@@ -59,12 +57,9 @@ ecore_idle_exiter_add(Ecore_Task_Cb func,
59 return ie; 57 return ie;
60} 58}
61 59
62static void 60EOLIAN static void
63_idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 61_ecore_idle_exiter_constructor(Eo *obj, Ecore_Idle_Exiter_Data *ie, Ecore_Task_Cb func, const void *data)
64{ 62{
65 Ecore_Task_Cb func = va_arg(*list, Ecore_Task_Cb);
66 const void *data = va_arg(*list, const void *);
67
68 _ecore_lock(); 63 _ecore_lock();
69 if (EINA_UNLIKELY(!eina_main_loop_is())) 64 if (EINA_UNLIKELY(!eina_main_loop_is()))
70 { 65 {
@@ -72,7 +67,6 @@ _idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
72 EINA_MAIN_LOOP_CHECK_RETURN; 67 EINA_MAIN_LOOP_CHECK_RETURN;
73 } 68 }
74 69
75 Ecore_Idle_Exiter_Private_Data *ie = _pd;
76 70
77 ie->obj = obj; 71 ie->obj = obj;
78 eo_do_super(obj, MY_CLASS, eo_constructor()); 72 eo_do_super(obj, MY_CLASS, eo_constructor());
@@ -88,12 +82,12 @@ _idle_exiter_constructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
88 ie->func = func; 82 ie->func = func;
89 ie->data = (void *)data; 83 ie->data = (void *)data;
90 84
91 idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); 85 idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
92 _ecore_unlock(); 86 _ecore_unlock();
93} 87}
94 88
95static void 89EOLIAN static void
96_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) 90_ecore_idle_exiter_eo_base_constructor(Eo *obj, Ecore_Idle_Exiter_Data *_pd EINA_UNUSED)
97{ 91{
98 eo_error_set(obj); 92 eo_error_set(obj);
99 ERR("only custom constructor can be used with '%s' class", MY_CLASS_NAME); 93 ERR("only custom constructor can be used with '%s' class", MY_CLASS_NAME);
@@ -125,7 +119,7 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
125static void * 119static void *
126_ecore_idle_exiter_del(Ecore_Idle_Exiter *obj) 120_ecore_idle_exiter_del(Ecore_Idle_Exiter *obj)
127{ 121{
128 Ecore_Idle_Exiter_Private_Data *idle_exiter = eo_data_scope_get(obj, MY_CLASS); 122 Ecore_Idle_Exiter_Data *idle_exiter = eo_data_scope_get(obj, MY_CLASS);
129 EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL); 123 EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
130 idle_exiter->delete_me = 1; 124 idle_exiter->delete_me = 1;
131 idle_exiters_delete_me = 1; 125 idle_exiters_delete_me = 1;
@@ -133,10 +127,9 @@ _ecore_idle_exiter_del(Ecore_Idle_Exiter *obj)
133} 127}
134 128
135 129
136static void 130EOLIAN static void
137_destructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED) 131_ecore_idle_exiter_eo_base_destructor(Eo *obj, Ecore_Idle_Exiter_Data *idle_exiter)
138{ 132{
139 Ecore_Idle_Exiter_Private_Data *idle_exiter = _pd;
140 133
141 idle_exiter->delete_me = 1; 134 idle_exiter->delete_me = 1;
142 idle_exiters_delete_me = 1; 135 idle_exiters_delete_me = 1;
@@ -147,10 +140,10 @@ _destructor(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
147void 140void
148_ecore_idle_exiter_shutdown(void) 141_ecore_idle_exiter_shutdown(void)
149{ 142{
150 Ecore_Idle_Exiter_Private_Data *ie; 143 Ecore_Idle_Exiter_Data *ie;
151 while ((ie = idle_exiters)) 144 while ((ie = idle_exiters))
152 { 145 {
153 idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters)); 146 idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
154 147
155 eo_do(ie->obj, eo_parent_set(NULL)); 148 eo_do(ie->obj, eo_parent_set(NULL));
156 if (eo_destructed_is(ie->obj)) 149 if (eo_destructed_is(ie->obj))
@@ -174,12 +167,12 @@ _ecore_idle_exiter_call(void)
174 { 167 {
175 /* recursive main loop, continue from where we were */ 168 /* recursive main loop, continue from where we were */
176 idle_exiter_current = 169 idle_exiter_current =
177 (Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(idle_exiter_current)->next; 170 (Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
178 } 171 }
179 172
180 while (idle_exiter_current) 173 while (idle_exiter_current)
181 { 174 {
182 Ecore_Idle_Exiter_Private_Data *ie = (Ecore_Idle_Exiter_Private_Data *)idle_exiter_current; 175 Ecore_Idle_Exiter_Data *ie = (Ecore_Idle_Exiter_Data *)idle_exiter_current;
183 if (!ie->delete_me) 176 if (!ie->delete_me)
184 { 177 {
185 ie->references++; 178 ie->references++;
@@ -191,18 +184,18 @@ _ecore_idle_exiter_call(void)
191 } 184 }
192 if (idle_exiter_current) /* may have changed in recursive main loops */ 185 if (idle_exiter_current) /* may have changed in recursive main loops */
193 idle_exiter_current = 186 idle_exiter_current =
194 (Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(idle_exiter_current)->next; 187 (Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(idle_exiter_current)->next;
195 } 188 }
196 if (idle_exiters_delete_me) 189 if (idle_exiters_delete_me)
197 { 190 {
198 Ecore_Idle_Exiter_Private_Data *l; 191 Ecore_Idle_Exiter_Data *l;
199 int deleted_idler_exiters_in_use = 0; 192 int deleted_idler_exiters_in_use = 0;
200 193
201 for (l = idle_exiters; l; ) 194 for (l = idle_exiters; l; )
202 { 195 {
203 Ecore_Idle_Exiter_Private_Data *ie = l; 196 Ecore_Idle_Exiter_Data *ie = l;
204 197
205 l = (Ecore_Idle_Exiter_Private_Data *)EINA_INLIST_GET(l)->next; 198 l = (Ecore_Idle_Exiter_Data *)EINA_INLIST_GET(l)->next;
206 if (ie->delete_me) 199 if (ie->delete_me)
207 { 200 {
208 if (ie->references) 201 if (ie->references)
@@ -211,7 +204,7 @@ _ecore_idle_exiter_call(void)
211 continue; 204 continue;
212 } 205 }
213 206
214 idle_exiters = (Ecore_Idle_Exiter_Private_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); 207 idle_exiters = (Ecore_Idle_Exiter_Data *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
215 208
216 eo_do(ie->obj, eo_parent_set(NULL)); 209 eo_do(ie->obj, eo_parent_set(NULL));
217 if (eo_destructed_is(ie->obj)) 210 if (eo_destructed_is(ie->obj))
@@ -232,34 +225,4 @@ _ecore_idle_exiter_exist(void)
232 return 0; 225 return 0;
233} 226}
234 227
235static void 228#include "ecore_idle_exiter.eo.c" \ No newline at end of file
236_class_constructor(Eo_Class *klass)
237{
238 const Eo_Op_Func_Description func_desc[] = {
239 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
240 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
241
242 EO_OP_FUNC(ECORE_IDLE_EXITER_ID(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR), _idle_exiter_constructor),
243 EO_OP_FUNC_SENTINEL
244 };
245
246 eo_class_funcs_set(klass, func_desc);
247}
248
249static const Eo_Op_Description op_desc[] = {
250 EO_OP_DESCRIPTION(ECORE_IDLE_EXITER_SUB_ID_CONSTRUCTOR, "Add an idle exiter handler."),
251 EO_OP_DESCRIPTION_SENTINEL
252};
253
254static const Eo_Class_Description class_desc = {
255 EO_VERSION,
256 MY_CLASS_NAME,
257 EO_CLASS_TYPE_REGULAR,
258 EO_CLASS_DESCRIPTION_OPS(&ECORE_IDLE_EXITER_BASE_ID, op_desc, ECORE_IDLE_EXITER_SUB_ID_LAST),
259 NULL,
260 sizeof(Ecore_Idle_Exiter_Private_Data),
261 _class_constructor,
262 NULL
263};
264
265EO_DEFINE_CLASS(ecore_idle_exiter_class_get, &class_desc, EO_BASE_CLASS, NULL)
diff --git a/src/lib/ecore/ecore_idle_exiter.eo b/src/lib/ecore/ecore_idle_exiter.eo
new file mode 100644
index 0000000000..eefe4a098b
--- /dev/null
+++ b/src/lib/ecore/ecore_idle_exiter.eo
@@ -0,0 +1,17 @@
1class Ecore_Idle_Exiter (Eo_Base)
2{
3 eo_prefix: ecore_idle_exiter;
4 constructors {
5 constructor {
6 /*@ Contructor. */
7 params {
8 @in Ecore_Task_Cb func;
9 @in const void *data;
10 }
11 }
12 }
13 implements {
14 Eo_Base::constructor;
15 Eo_Base::destructor;
16 }
17} \ No newline at end of file