summaryrefslogtreecommitdiff
path: root/src/lib/eo
diff options
context:
space:
mode:
authorGuilherme Iscaro <iscaro@profusion.mobi>2017-08-08 18:10:36 -0300
committerGuilherme Iscaro <iscaro@profusion.mobi>2017-09-04 10:24:00 -0300
commit5bd8c9a78d7bc21a956b775fb250e8e14711d5b9 (patch)
tree5a3b270ecd53a712b66ad32e2989091250418423 /src/lib/eo
parentc9a0237770a7fb0f1d94c9f99b7cab68399a922f (diff)
Eina: Add Eina_Promise/Eina_Future.
This commit adds a new promise/future API which aims to replace efl_future.
Diffstat (limited to 'src/lib/eo')
-rw-r--r--src/lib/eo/eina_types.eot81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/lib/eo/eina_types.eot b/src/lib/eo/eina_types.eot
index 40fbbf2df8..83be600926 100644
--- a/src/lib/eo/eina_types.eot
+++ b/src/lib/eo/eina_types.eot
@@ -62,3 +62,84 @@ struct @extern Eina.Rw_Slice {
62} 62}
63 63
64struct @extern Eina.Value.Type; [[Eina value type]] 64struct @extern Eina.Value.Type; [[Eina value type]]
65
66struct @extern Eina.Future; [[Eina_Future handle]]
67struct @extern Eina.Promise; [[Eina_Promise handle]]
68struct @extern @free(eina_future_desc_flush) Eina_Future_Desc; [[A struct used to define a callback and data for a future.]]
69struct @extern @free(eina_future_cb_easy_desc_flush) Eina_Future_Cb_Easy_Desc; [[A struct with callbacks to be used by eina_future_cb_easy_from_desc() and eina_future_cb_easy()]]
70struct @extern Eina_Future_Cb_Console_Desc; [[A struct used to define the prefix and suffix to be printed
71 along side the a future value. This struct is used by
72 eina_future_cb_console_from_desc()]]
73struct @extern Eina_Future_Schedule_Entry; [[A struct that represents an scheduled event.
74 This struct may be used by Eina to cancel
75 a scheduled future.]]
76struct @extern Eina.Future.Scheduler; [[This struct is used as a bridge between Eina and the future scheduler.
77 By using the provided functions Eina can schedule futures resolutions,
78 rejections and cancelations to a safe context.]]
79
80function @extern Eina.Future.Cb {
81 params {
82 value: const(generic_value); [[An Eina_Value which contains the operation result. Before using
83 the value, its type must be checked in order to avoid errors. This is needed, because
84 if an operation fails the Eina_Value type will be EINA_VALUE_TYPE_ERROR
85 which is a different type than the expected operation result.]]
86 dead_ptr: const(ptr(Eina.Future)); [[A pointer to the future that was completed]]
87 }
88 return: generic_value; [[An Eina_Value to pass to the next Eina_Future in the chain (if any).
89 If there is no need to convert the received value, it's recommended
90 to pass-thru value argument. If you need to convert to a different type
91 or generate a new value, use eina_value_setup() on another Eina_Value
92 and return it. By returning an promise Eina_Value (eina_promise_as_value()) the
93 whole chain will wait until the promise is resolved in order to continue its execution.
94 Note that the value contents must survive this function scope,
95 that is, do not use stack allocated blobs, arrays, structures or types that
96 keeps references to memory you give. Values will be automatically cleaned up
97 using eina_value_flush() once they are unused (no more future or futures
98 returned a new value).]]
99};
100
101function @extern Eina.Promise.Cancel.Cb {
102 params {
103 dead_promise: const(ptr(Eina.Promise)); [[The canceled promise.]]
104 }
105};
106
107function @extern Eina.Future.Success.Cb {
108 params {
109 value: const(generic_value); [[The operation result]]
110 }
111 return: generic_value; [[An Eina_Value to pass to the next Eina_Future in the chain (if any).
112 If there is no need to convert the received value, it's recommended
113 to pass-thru value argument. If you need to convert to a different type
114 or generate a new value, use eina_value_setup() on another Eina_Value
115 and return it. By returning an promise Eina_Value (eina_promise_as_value()) the
116 whole chain will wait until the promise is resolved in order to continue its execution.
117 Note that the value contents must survive this function scope,
118 that is, do not use stack allocated blobs, arrays, structures or types that
119 keeps references to memory you give. Values will be automatically cleaned up
120 using eina_value_flush() once they are unused (no more future or futures
121 returned a new value).]]
122};
123
124function @extern Eina.Future.Error.Cb {
125 params {
126 error: const(Eina.Error); [[The operation error]]
127 }
128 return: generic_value; [[An Eina_Value to pass to the next Eina_Future in the chain (if any).
129 If there is no need to convert the received value, it's recommended
130 to pass-thru value argument. If you need to convert to a different type
131 or generate a new value, use eina_value_setup() on another Eina_Value
132 and return it. By returning an promise Eina_Value (eina_promise_as_value()) the
133 whole chain will wait until the promise is resolved in order to continue its execution.
134 Note that the value contents must survive this function scope,
135 that is, do not use stack allocated blobs, arrays, structures or types that
136 keeps references to memory you give. Values will be automatically cleaned up
137 using eina_value_flush() once they are unused (no more future or futures
138 returned a new value).]]
139};
140
141function @extern Eina.Future.Free.Cb {
142 params {
143 dead_future: const(ptr(Eina.Future)); [[The future that was freed]]
144 }
145};