ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/examples.git/commit/?id=348ea102724725b88497fe53ecfaa658d9656c0a

commit 348ea102724725b88497fe53ecfaa658d9656c0a
Author: Andy Williams <[email protected]>
Date:   Fri Dec 22 12:23:54 2017 +0000

    eina: use a timer instead of another future for our first example
---
 reference/c/eina/src/eina_future.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/reference/c/eina/src/eina_future.c 
b/reference/c/eina/src/eina_future.c
index 58c7279..10c52fa 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));
 }
 
 /*

-- 


Reply via email to