aboutsummaryrefslogtreecommitdiffstats
path: root/reference
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-12-22 12:23:54 +0000
committerAndy Williams <andy@andywilliams.me>2017-12-22 12:23:54 +0000
commit348ea102724725b88497fe53ecfaa658d9656c0a (patch)
treeae514e4cdd0451d895249f0367deddff229ea18c /reference
parenteina: Fix futures for new core loop (diff)
downloadexamples-348ea102724725b88497fe53ecfaa658d9656c0a.tar.gz
eina: use a timer instead of another future for our first example
Diffstat (limited to 'reference')
-rw-r--r--reference/c/eina/src/eina_future.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/reference/c/eina/src/eina_future.c b/reference/c/eina/src/eina_future.c
index 58c72795..10c52fa2 100644
--- a/reference/c/eina/src/eina_future.c
+++ b/reference/c/eina/src/eina_future.c
@@ -37,15 +37,15 @@ _value_print(void *data EINA_UNUSED, const Eina_Value value)
/*
* This method will resolve the passed promise with a string value
*/
-static Eina_Value
-_delayed_value_resolve(void *data, const Eina_Value value EINA_UNUSED)
+static void
+_delayed_value_resolve(void *data, const Efl_Event *event)
{
Eina_Promise *promise;
promise = (Eina_Promise *)data;
eina_promise_resolve(promise, eina_value_string_init("Delayed Value :)"));
- return EINA_VALUE_EMPTY;
+ efl_del(event->object);
}
/*
@@ -66,8 +66,10 @@ _simple_future()
eina_future_then_easy(eina_future_new(promise), .success = _value_print);
// This future is basically a timer - wait 100ms and then resolve the promise above
- eina_future_then_easy(efl_loop_timeout(efl_loop_main_get(EFL_LOOP_CLASS), 0.1),
- .success = _delayed_value_resolve, .data = promise);
+ efl_add(EFL_LOOP_TIMER_CLASS, loop,
+ efl_loop_timer_interval_set(efl_added, 0.1),
+ efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK,
+ _delayed_value_resolve, promise));
}
/*