summaryrefslogtreecommitdiff
path: root/src/lib/evas/file
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-12-06 11:34:56 -0800
committerCedric BAIL <cedric@osg.samsung.com>2016-12-06 16:26:08 -0800
commit27a47da15bcb97458406ec176e1e92fa92ede99f (patch)
tree9c2a4aed58557e25cc13aa814cddfd51e851b881 /src/lib/evas/file
parent3fab2729067b34111d3208c7ca0b273b90241114 (diff)
evas: add infrastructure for Evas_Loader to know if what they are working on is still useful.
Diffstat (limited to 'src/lib/evas/file')
-rw-r--r--src/lib/evas/file/evas_module.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c
index a7d46c2933..5c1f5d6c20 100644
--- a/src/lib/evas/file/evas_module.c
+++ b/src/lib/evas/file/evas_module.c
@@ -28,6 +28,51 @@
28#define EVAS_MODULE_NO_VG_SAVERS 0 28#define EVAS_MODULE_NO_VG_SAVERS 0
29#endif 29#endif
30 30
31typedef struct _Evas_Module_Task Evas_Module_Task;
32struct _Evas_Module_Task
33{
34 Eina_Bool (*cancelled)(void *data);
35 void *data;
36};
37
38static Eina_TLS task = 0;
39
40EAPI Eina_Bool
41evas_module_task_cancelled(void)
42{
43 Evas_Module_Task *t;
44
45 t = eina_tls_get(task);
46 if (!t) return EINA_FALSE;
47
48 return t->cancelled(t->data);
49}
50
51EAPI void
52evas_module_task_register(Eina_Bool (*cancelled)(void *data), void *data)
53{
54 Evas_Module_Task *t;
55
56 t = malloc(sizeof (Evas_Module_Task));
57 if (!t) return ;
58
59 t->cancelled = cancelled;
60 t->data = data;
61
62 eina_tls_set(task, t);
63}
64
65EAPI void
66evas_module_task_unregister(void)
67{
68 Evas_Module_Task *t;
69
70 t = eina_tls_get(task);
71 if (!t) return ;
72
73 eina_tls_set(task, NULL);
74 free(t);
75}
31 76
32static Eina_Hash *evas_modules[6] = { 77static Eina_Hash *evas_modules[6] = {
33 NULL, 78 NULL,
@@ -318,6 +363,8 @@ evas_module_init(void)
318 363
319 evas_engines = eina_array_new(4); 364 evas_engines = eina_array_new(4);
320 365
366 eina_tls_cb_new(&task, (Eina_TLS_Delete_Cb) evas_module_task_unregister);
367
321 for (i = 0; evas_static_module[i].init; ++i) 368 for (i = 0; evas_static_module[i].init; ++i)
322 evas_static_module[i].init(); 369 evas_static_module[i].init();
323} 370}
@@ -694,6 +741,8 @@ evas_module_shutdown(void)
694 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_VG_SAVER]); 741 eina_hash_free(evas_modules[EVAS_MODULE_TYPE_VG_SAVER]);
695 evas_modules[EVAS_MODULE_TYPE_VG_SAVER] = NULL; 742 evas_modules[EVAS_MODULE_TYPE_VG_SAVER] = NULL;
696 743
744 eina_tls_free(task);
745
697 EINA_LIST_FREE(evas_module_paths, path) 746 EINA_LIST_FREE(evas_module_paths, path)
698 free(path); 747 free(path);
699 748