summaryrefslogtreecommitdiff
path: root/src/lib
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 /src/lib
parentaffd07a11f08610553b12fdee9ac2d510938712c (diff)
eio: migrate Efl.Io.Manager.xattr_ls to use Eina_Future.
Diffstat (limited to 'src/lib')
-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,
466 466
467/* eXtended attribute manipulation */ 467/* eXtended attribute manipulation */
468 468
469static Efl_Future * 469static Eina_Future *
470_efl_io_manager_xattr_ls(Eo *obj, 470_efl_io_manager_xattr_ls(Eo *obj,
471 Efl_Io_Manager_Data *pd EINA_UNUSED, 471 Efl_Io_Manager_Data *pd EINA_UNUSED,
472 const char *path) 472 const char *path,
473 void *paths_data, EflIoPath paths, Eina_Free_Cb paths_free_cb)
473{ 474{
474 Efl_Promise *p; 475 Eina_Promise *p;
476 Eina_Future *future;
475 Eio_File *h; 477 Eio_File *h;
476 478
477 Eo *loop = efl_loop_get(obj); 479 p = eina_promise_new(efl_loop_future_scheduler_get(obj),
478 p = efl_add(EFL_PROMISE_CLASS, loop); 480 _efl_io_manager_future_cancel, NULL);
479 if (!p) return NULL; 481 if (!p) return NULL;
482 future = eina_future_new(p);
480 483
481 h = _eio_file_xattr(path, 484 h = _eio_file_xattr(path,
482 _file_string_cb, 485 _future_string_cb,
483 _file_done_cb, 486 _future_file_done_cb,
484 _file_error_cb, 487 _future_file_error_cb,
485 p); 488 p);
486 if (!h) goto end; 489 if (!h) goto end;
487 490
488 efl_event_callback_array_add(p, promise_progress_handling(), h); 491 // There is no race condition here as all the callback are called in the main loop after this
489 return efl_promise_future_get(p); 492 ecore_thread_local_data_add(h->thread, ".paths", paths, NULL, EINA_TRUE);
493 ecore_thread_local_data_add(h->thread, ".paths_data", paths_data, paths_free_cb, EINA_TRUE);
494 eina_promise_data_set(p, h);
495
496 return efl_future_Eina_FutureXXX_then(obj, future);
490 497
491 end: 498 end:
492 efl_del(p); 499 return efl_future_Eina_FutureXXX_then(obj, future);;
493 return NULL;
494} 500}
495 501
496static void 502static 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)
60 [[Lists all extended attributes asynchronously.]] 60 [[Lists all extended attributes asynchronously.]]
61 params { 61 params {
62 @in path: string; [[Path we want to list entries for]] 62 @in path: string; [[Path we want to list entries for]]
63 paths: EflIoPath; [[Callback called for each packet of extended attributes found.]]
63 } 64 }
64 return: future<uint64, const(array<string>)>; [[Extended attributes]] 65 return: ptr(Eina.Future) @owned; [[Amount of extended attributes found]]
65 } 66 }
66 67
67 stat { 68 stat {