summaryrefslogtreecommitdiff
path: root/src/lib/efl_mono
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/efl_mono')
-rw-r--r--src/lib/efl_mono/efl_custom_exports_mono.c49
1 files changed, 48 insertions, 1 deletions
diff --git a/src/lib/efl_mono/efl_custom_exports_mono.c b/src/lib/efl_mono/efl_custom_exports_mono.c
index fce3a43a1e..669625969e 100644
--- a/src/lib/efl_mono/efl_custom_exports_mono.c
+++ b/src/lib/efl_mono/efl_custom_exports_mono.c
@@ -1,5 +1,6 @@
1#include "Eo.h" 1#include "Eo.h"
2#include "Eina.h" 2#include "Eina.h"
3#include "Ecore.h"
3 4
4#include <stdlib.h> 5#include <stdlib.h>
5#include <string.h> 6#include <string.h>
@@ -22,6 +23,52 @@
22# endif 23# endif
23#endif /* ! _WIN32 */ 24#endif /* ! _WIN32 */
24 25
26static void _efl_mono_unref_cb(void *obj)
27{
28 efl_unref(obj);
29}
30
31EAPI void efl_mono_thread_safe_efl_unref(Eo* obj)
32{
33 ecore_main_loop_thread_safe_call_async(_efl_mono_unref_cb, obj);
34}
35
36EAPI void efl_mono_thread_safe_free_cb_exec(Eina_Free_Cb free_cb, void* cb_data)
37{
38 ecore_main_loop_thread_safe_call_async(free_cb, cb_data);
39}
40
41static void _efl_mono_list_free_cb(void *l)
42{
43 eina_list_free(l);
44}
45
46EAPI void efl_mono_thread_safe_eina_list_free(Eina_List* list)
47{
48 ecore_main_loop_thread_safe_call_async(_efl_mono_list_free_cb, list);
49}
50
51typedef struct _Efl_Mono_Promise_Reject_Data
52{
53 Eina_Promise *promise;
54 Eina_Error err;
55} Efl_Mono_Promise_Reject_Data;
56
57static void _efl_mono_promise_reject_cb(void *data)
58{
59 Efl_Mono_Promise_Reject_Data *d = data;
60 eina_promise_reject(d->promise, d->err);
61 free(d);
62}
63
64EAPI void efl_mono_thread_safe_promise_reject(Eina_Promise *p, Eina_Error err)
65{
66 Efl_Mono_Promise_Reject_Data *d = malloc(sizeof(Efl_Mono_Promise_Reject_Data));
67 d->promise = p;
68 d->err = err;
69 ecore_main_loop_thread_safe_call_async(_efl_mono_promise_reject_cb, d);
70}
71
25EAPI void *efl_mono_native_alloc(unsigned int size) 72EAPI void *efl_mono_native_alloc(unsigned int size)
26{ 73{
27 return malloc(size); 74 return malloc(size);
@@ -81,7 +128,7 @@ EAPI Eina_Free_Cb efl_mono_native_free_addr_get()
81 128
82EAPI Eina_Free_Cb efl_mono_native_efl_unref_addr_get() 129EAPI Eina_Free_Cb efl_mono_native_efl_unref_addr_get()
83{ 130{
84 return (Eina_Free_Cb)efl_unref; 131 return (Eina_Free_Cb)efl_mono_thread_safe_efl_unref;
85} 132}
86 133
87// Iterator Wrapper // 134// Iterator Wrapper //