summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-09-12 14:08:40 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-09-12 14:08:40 -0700
commitde106a29733daf398d318eae2aa6e1c1c8581970 (patch)
treeda1579f732eda12d51f319cbc002a2d6c8e16791 /src/lib/eio
parent2e4d357a26950864f6edf03c3b664fcad8b0d036 (diff)
eio: move efl.io.manager.close to use the new future.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/efl_io_manager.c21
-rw-r--r--src/lib/eio/efl_io_manager.eo2
2 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/eio/efl_io_manager.c b/src/lib/eio/efl_io_manager.c
index e4100810af..75fa2289b0 100644
--- a/src/lib/eio/efl_io_manager.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -558,30 +558,31 @@ _efl_io_manager_open(Eo *obj,
558 return NULL; 558 return NULL;
559} 559}
560 560
561static Efl_Future * 561static Eina_Future *
562_efl_io_manager_close(Eo *obj, 562_efl_io_manager_close(Eo *obj,
563 Efl_Io_Manager_Data *pd EINA_UNUSED, 563 Efl_Io_Manager_Data *pd EINA_UNUSED,
564 Eina_File *file) 564 Eina_File *file)
565{ 565{
566 Efl_Promise *p; 566 Eina_Promise *p;
567 Eina_Future *future;
567 Eio_File *h; 568 Eio_File *h;
568 569
569 Eo *loop = efl_loop_get(obj); 570 p = eina_promise_new(efl_loop_future_scheduler_get(obj),
570 p = efl_add(EFL_PROMISE_CLASS, loop); 571 _efl_io_manager_future_cancel, NULL);
571 if (!p) return NULL; 572 if (!p) return NULL;
573 future = eina_future_new(p);
572 574
573 h = eio_file_close(file, 575 h = eio_file_close(file,
574 _file_done_cb, 576 _future_file_done_cb,
575 _file_error_cb, 577 _future_file_error_cb,
576 p); 578 p);
577 if (!h) goto end; 579 if (!h) goto end;
580 eina_promise_data_set(p, h);
578 581
579 efl_event_callback_array_add(p, promise_handling(), h); 582 return efl_future_Eina_FutureXXX_then(obj, future);
580 return efl_promise_future_get(p);
581 583
582 end: 584 end:
583 efl_del(p); 585 return future;
584 return NULL;
585} 586}
586 587
587#include "efl_io_manager.eo.c" 588#include "efl_io_manager.eo.c"
diff --git a/src/lib/eio/efl_io_manager.eo b/src/lib/eio/efl_io_manager.eo
index 34e70d985c..a4e8aaddc5 100644
--- a/src/lib/eio/efl_io_manager.eo
+++ b/src/lib/eio/efl_io_manager.eo
@@ -91,7 +91,7 @@ class Efl.Io.Manager (Efl.Loop_User)
91 @in file: ptr(Eina.File); [[Eina file handle]] 91 @in file: ptr(Eina.File); [[Eina file handle]]
92 // Here we're just interested whether the promise was fullfilled or not. No value needed. 92 // Here we're just interested whether the promise was fullfilled or not. No value needed.
93 } 93 }
94 return: future<int>; [[Close return code]] 94 return: own(ptr(Eina.Future)); [[Close return code]]
95 } 95 }
96 } 96 }
97} 97}