summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2018-01-03 12:12:48 -0800
committerCedric BAIL <cedric@osg.samsung.com>2018-01-03 12:16:25 -0800
commit5628ecddd6247fb201aa4a79a793e71e4785e789 (patch)
treecd8d47cacb7214c3d8fc6f9d674480790ac98a02
parent5efb8f3eb28b5f4a50524de61c2d7a8bb32523a9 (diff)
ecore: introduce efl_loop_promise_new to simplify creation of Eina_Promise.
-rw-r--r--src/lib/ecore/Ecore_Eo.h13
-rw-r--r--src/lib/ecore/efl_loop.c7
2 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/ecore/Ecore_Eo.h b/src/lib/ecore/Ecore_Eo.h
index c1e53bdc1d..fa5d08d798 100644
--- a/src/lib/ecore/Ecore_Eo.h
+++ b/src/lib/ecore/Ecore_Eo.h
@@ -70,6 +70,19 @@ EAPI int efl_loop_exit_code_process(Eina_Value *value);
70 */ 70 */
71EAPI Eina_Future_Scheduler *efl_loop_future_scheduler_get(const Eo *obj); 71EAPI Eina_Future_Scheduler *efl_loop_future_scheduler_get(const Eo *obj);
72 72
73/**
74 * @brief Create a future attached to the current loop
75 *
76 * @param[in] An object which will provide a loop, either by being a loop or a loop consumer
77 * @param cancel_cb A callback used to inform that the promise was canceled. Use
78 * this callback to @c free @p data. @p cancel_cb must not be @c NULL !
79 * @param data Data to @p cancel_cb.
80 * @return A promise or @c NULL on error.
81 *
82 * @see eina_promise_new()
83 */
84EAPI Eina_Promise *efl_loop_promise_new(const Eo *obj, Eina_Promise_Cancel_Cb cancel_cb, const void *data);
85
73#include "efl_loop_fd.eo.h" 86#include "efl_loop_fd.eo.h"
74#include "efl_loop_handler.eo.h" 87#include "efl_loop_handler.eo.h"
75 88
diff --git a/src/lib/ecore/efl_loop.c b/src/lib/ecore/efl_loop.c
index badd367cd8..221ad965fd 100644
--- a/src/lib/ecore/efl_loop.c
+++ b/src/lib/ecore/efl_loop.c
@@ -741,4 +741,11 @@ efl_loop_future_scheduler_get(const Eo *obj)
741#define EFL_LOOP_EXTRA_OPS \ 741#define EFL_LOOP_EXTRA_OPS \
742 EFL_OBJECT_OP_FUNC(efl_loop_message_process, _efl_loop_message_process) 742 EFL_OBJECT_OP_FUNC(efl_loop_message_process, _efl_loop_message_process)
743 743
744EAPI Eina_Promise *
745efl_loop_promise_new(const Eo *obj, Eina_Promise_Cancel_Cb cancel_cb, const void *data)
746{
747 return eina_promise_new(efl_loop_future_scheduler_get(obj),
748 cancel_cb, data);
749}
750
744#include "efl_loop.eo.c" 751#include "efl_loop.eo.c"