summaryrefslogtreecommitdiff
path: root/src/lib/eina
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-12-07 12:15:16 +0100
committerXavi Artigas <xavierartigas@yahoo.es>2018-12-07 12:23:11 +0100
commit33c00de365ab8ed2adebd86e5e3dc6091afc0fa9 (patch)
treefe0abdfc084f80f3c2c997f0ccfab2d5d45f3b25 /src/lib/eina
parente6f66e56fdc0989e73fc54809dea5368df68cfab (diff)
eo: make efl_future_then have a data pointer in addition of the object pointer.
Summary: In the case when you have multiple future in flight related to one object, you couldn't use the previous version of efl_future_then. Now all function calls take a void* pointer that allow multiple future to have their private data request data accessible in all the callback. This should not break released API as Eo.h is not released yet and so was efl_future_Eina_FutureXXX_then. Depends on D7332 Reviewers: felipealmeida, segfaultxavi, vitor.sousa, SanghyeonLee, bu5hm4n Reviewed By: segfaultxavi Subscribers: #reviewers, #committers Tags: #efl Maniphest Tasks: T7472 Differential Revision: https://phab.enlightenment.org/D7379
Diffstat (limited to 'src/lib/eina')
-rw-r--r--src/lib/eina/eina_promise_private.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/eina/eina_promise_private.h b/src/lib/eina/eina_promise_private.h
index 31375b5794..1aeb2e7e6e 100644
--- a/src/lib/eina/eina_promise_private.h
+++ b/src/lib/eina/eina_promise_private.h
@@ -1,38 +1,38 @@
1#ifndef __EINA_PROMISE_PRIVATE_H__ 1#ifndef __EINA_PROMISE_PRIVATE_H__
2#define __EINA_PROMISE_PRIVATE_H__ 2#define __EINA_PROMISE_PRIVATE_H__
3 3
4#define ERROR_DISPATCH(_cbs, _ret, _value, _data) \ 4#define ERROR_DISPATCH(_cbs, _ret, _value, ...) \
5 do { \ 5 do { \
6 Eina_Error ERROR_DISPATCH__err; \ 6 Eina_Error ERROR_DISPATCH__err; \
7 if (!(_cbs)->error) (_ret) = (_value); \ 7 if (!(_cbs)->error) (_ret) = (_value); \
8 else \ 8 else \
9 { \ 9 { \
10 eina_value_get(&(_value), &ERROR_DISPATCH__err); \ 10 eina_value_get(&(_value), &ERROR_DISPATCH__err); \
11 (_ret) = (_cbs)->error((_data), ERROR_DISPATCH__err); \ 11 (_ret) = (_cbs)->error(__VA_ARGS__, ERROR_DISPATCH__err); \
12 } \ 12 } \
13 } while (0) 13 } while (0)
14 14
15#define EASY_FUTURE_DISPATCH(_ret, _value, _dead_future, _cbs, _data) \ 15#define EASY_FUTURE_DISPATCH(_ret, _value, _dead_future, _cbs, ...) \
16 do { \ 16 do { \
17 if ((_value).type == EINA_VALUE_TYPE_ERROR) ERROR_DISPATCH((_cbs), (_ret), (_value), (_data)); \ 17 if ((_value).type == EINA_VALUE_TYPE_ERROR) ERROR_DISPATCH((_cbs), (_ret), (_value), __VA_ARGS__); \
18 else \ 18 else \
19 { \ 19 { \
20 if ((!(_cbs)->success_type) || ((_cbs)->success_type && (_value).type == (_cbs)->success_type)) \ 20 if ((!(_cbs)->success_type) || ((_cbs)->success_type && (_value).type == (_cbs)->success_type)) \
21 { \ 21 { \
22 if (!(_cbs)->success) (_ret) = (_value); /* pass thru */ \ 22 if (!(_cbs)->success) (_ret) = (_value); /* pass thru */ \
23 else (_ret) = (_cbs)->success((_data), (_value)); \ 23 else (_ret) = (_cbs)->success(__VA_ARGS__, (_value)); \
24 } \ 24 } \
25 else \ 25 else \
26 { \ 26 { \
27 Eina_Value EASY_FUTURE_DISPATCH__err = EINA_VALUE_EMPTY; \ 27 Eina_Value EASY_FUTURE_DISPATCH__err = EINA_VALUE_EMPTY; \
28 ERR("Future %p, success cb: %p data: %p, expected success_type %p (%s), got %p (%s)", \ 28 ERR("Future %p, success cb: %p, expected success_type %p (%s), got %p (%s)", \
29 _dead_future, (_cbs)->success, (_data), \ 29 _dead_future, (_cbs)->success, \
30 (_cbs)->success_type, eina_value_type_name_get((_cbs)->success_type), \ 30 (_cbs)->success_type, eina_value_type_name_get((_cbs)->success_type), \
31 (_value).type, (_value).type ? eina_value_type_name_get((_value).type) : NULL); \ 31 (_value).type, (_value).type ? eina_value_type_name_get((_value).type) : NULL); \
32 if (eina_value_setup(&EASY_FUTURE_DISPATCH__err, EINA_VALUE_TYPE_ERROR)) eina_value_set(&EASY_FUTURE_DISPATCH__err, EINVAL); \ 32 if (eina_value_setup(&EASY_FUTURE_DISPATCH__err, EINA_VALUE_TYPE_ERROR)) eina_value_set(&EASY_FUTURE_DISPATCH__err, EINVAL); \
33 ERROR_DISPATCH((_cbs), (_ret), EASY_FUTURE_DISPATCH__err, (_data)); \ 33 ERROR_DISPATCH((_cbs), (_ret), EASY_FUTURE_DISPATCH__err, __VA_ARGS__); \
34 } \ 34 } \
35 } \ 35 } \
36 if ((_cbs)->free) (_cbs)->free((_data), _dead_future); \ 36 if ((_cbs)->free) (_cbs)->free(__VA_ARGS__, _dead_future); \
37 } while(0) 37 } while(0)
38#endif 38#endif