summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-12-14 16:02:49 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-12-14 16:42:44 -0800
commitd5c9c0b784a80fe80c0c4066dd8e0deb70bcbd3c (patch)
tree91118ee2ac9dc0541177f024ea4ec2605f1b59b9
parentaffd07a11f08610553b12fdee9ac2d510938712c (diff)
downloadefl-d5c9c0b784a80fe80c0c4066dd8e0deb70bcbd3c.tar.gz
eio: migrate Efl.Io.Manager.xattr_ls to use Eina_Future.
-rw-r--r--src/lib/eio/efl_io_manager.c30
-rw-r--r--src/lib/eio/efl_io_manager.eo3
2 files changed, 20 insertions, 13 deletions
diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
index 4d832dffc5..e6066eaa3b 100644
--- a/src/lib/eio/efl_io_manager.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -466,31 +466,37 @@ _efl_io_manager_stat(Eo *obj,
/* eXtended attribute manipulation */
-static Efl_Future *
+static Eina_Future *
_efl_io_manager_xattr_ls(Eo *obj,
Efl_Io_Manager_Data *pd EINA_UNUSED,
- const char *path)
+ const char *path,
+ void *paths_data, EflIoPath paths, Eina_Free_Cb paths_free_cb)
{
- Efl_Promise *p;
+ Eina_Promise *p;
+ Eina_Future *future;
Eio_File *h;
- Eo *loop = efl_loop_get(obj);
- p = efl_add(EFL_PROMISE_CLASS, loop);
+ p = eina_promise_new(efl_loop_future_scheduler_get(obj),
+ _efl_io_manager_future_cancel, NULL);
if (!p) return NULL;
+ future = eina_future_new(p);
h = _eio_file_xattr(path,
- _file_string_cb,
- _file_done_cb,
- _file_error_cb,
+ _future_string_cb,
+ _future_file_done_cb,
+ _future_file_error_cb,
p);
if (!h) goto end;
- efl_event_callback_array_add(p, promise_progress_handling(), h);
- return efl_promise_future_get(p);
+ // There is no race condition here as all the callback are called in the main loop after this
+ ecore_thread_local_data_add(h->thread, ".paths", paths, NULL, EINA_TRUE);
+ ecore_thread_local_data_add(h->thread, ".paths_data", paths_data, paths_free_cb, EINA_TRUE);
+ eina_promise_data_set(p, h);
+
+ return efl_future_Eina_FutureXXX_then(obj, future);
end:
- efl_del(p);
- return NULL;
+ return efl_future_Eina_FutureXXX_then(obj, future);;
}
static void
diff --git a/src/lib/eio/efl_io_manager.eo b/src/lib/eio/efl_io_manager.eo
index 84ac7700b6..371d71f7cd 100644
--- a/src/lib/eio/efl_io_manager.eo
+++ b/src/lib/eio/efl_io_manager.eo
@@ -60,8 +60,9 @@ class Efl.Io.Manager (Efl.Loop.Consumer)
[[Lists all extended attributes asynchronously.]]
params {
@in path: string; [[Path we want to list entries for]]
+ paths: EflIoPath; [[Callback called for each packet of extended attributes found.]]
}
- return: future<uint64, const(array<string>)>; [[Extended attributes]]
+ return: ptr(Eina.Future) @owned; [[Amount of extended attributes found]]
}
stat {