On Mon, Sep 11, 2017 at 8:15 PM, Cedric BAIL <[email protected]> wrote:
> cedric pushed a commit to branch master.
>
> http://git.enlightenment.org/core/efl.git/commit/?id=e33d0d99963f16038d33f8d95cf5427e2ed29390
>
> commit e33d0d99963f16038d33f8d95cf5427e2ed29390
> Author: Cedric BAIL <[email protected]>
> Date:   Mon Sep 11 16:10:46 2017 -0700
>
>     eio: first convertion to new future/promise.
> ---
>  src/lib/eio/efl_io_manager.c           | 51 
> +++++++++++++++++++++++++++-------
>  src/lib/eio/efl_io_manager.eo          |  2 +-
>  src/tests/eio/eio_test_manager_xattr.c | 43 ++++++++++++++++++++++++----
>  3 files changed, 80 insertions(+), 16 deletions(-)
>
> diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
> index 51043f88c8..dc7b243ecf 100644
> --- a/src/lib/eio/efl_io_manager.c
> +++ b/src/lib/eio/efl_io_manager.c
> @@ -434,7 +434,37 @@ _efl_io_manager_xattr_ls(Eo *obj,
>     return NULL;
>  }
>
> -static Efl_Future *
> +static void
> +_future_file_done_cb(void *data, Eio_File *handler)
> +{
> +   Eina_Promise *p = data;
> +   Eina_Value v = EINA_VALUE_EMPTY;
> +
> +   eina_value_setup(&v, EINA_VALUE_TYPE_UINT64);
> +   eina_value_set(&v, handler->length);
> +   eina_promise_resolve(p, v);

you can make it an one-line with eina_value_util
(https://git.enlightenment.org/core/efl.git/tree/src/lib/eina/eina_inline_value_util.x)

eina_promise_resolve(p, eina_value_uint64_init(handler->length));


> +}
> +
> +static void
> +_future_file_error_cb(void *data,
> +                      Eio_File *handler EINA_UNUSED,
> +                      int error)
> +{
> +   Eina_Promise *p = data;
> +   Eina_Value v = EINA_VALUE_EMPTY;
> +
> +   eina_value_setup(&v, EINA_VALUE_TYPE_ERROR);
> +   eina_value_set(&v, error);
> +   eina_promise_resolve(p, v);

eina_promise_reject(p, error);



-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to