forked from enlightenment/efl
eio: move efl.io.manager.close to use the new future.
This commit is contained in:
parent
2e4d357a26
commit
de106a2973
|
@ -558,30 +558,31 @@ _efl_io_manager_open(Eo *obj,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static Efl_Future *
|
||||
static Eina_Future *
|
||||
_efl_io_manager_close(Eo *obj,
|
||||
Efl_Io_Manager_Data *pd EINA_UNUSED,
|
||||
Eina_File *file)
|
||||
{
|
||||
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_close(file,
|
||||
_file_done_cb,
|
||||
_file_error_cb,
|
||||
_future_file_done_cb,
|
||||
_future_file_error_cb,
|
||||
p);
|
||||
if (!h) goto end;
|
||||
eina_promise_data_set(p, h);
|
||||
|
||||
efl_event_callback_array_add(p, promise_handling(), h);
|
||||
return efl_promise_future_get(p);
|
||||
return efl_future_Eina_FutureXXX_then(obj, future);
|
||||
|
||||
end:
|
||||
efl_del(p);
|
||||
return NULL;
|
||||
return future;
|
||||
}
|
||||
|
||||
#include "efl_io_manager.eo.c"
|
||||
|
|
|
@ -91,7 +91,7 @@ class Efl.Io.Manager (Efl.Loop_User)
|
|||
@in file: ptr(Eina.File); [[Eina file handle]]
|
||||
// Here we're just interested whether the promise was fullfilled or not. No value needed.
|
||||
}
|
||||
return: future<int>; [[Close return code]]
|
||||
return: own(ptr(Eina.Future)); [[Close return code]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue