In many cases we use events as a single shot event, then we efl_event_callback_add(), wait for the callback, then efl_event_callback_del()...
With the introduction of Promise/Future pair it would be nice to have that automated, for example Efl.Io.Copier produces an event "done". Most of the times when you're using Efl.Io.Copier you only want to know when it was finished or when it produced an error (event: "error"). Then it would improve usability to do something like: Eina_Future *f = efl_future_event(copier, EFL_IO_COPIER_EVENT_DONE, /* success event */ EFL_IO_COPIER_EVENT_ERROR); /* error event */ eina_future_chain(f, do_something, do_something_else, on_error); and all would be handled for you: add/del callbacks, resolve the promise and all. This is doable, EXCEPT events are "void *" and may go away when the event callback returns. However eina_promise_resolve() will postpone the future chain to another mainloop iteration -- thus needs a COPY. How to copy "void *"? My suggestion is to store an Eina_Value_Type in Efl_Event_Description, this way I can easily allocate and call copy on the type (eina_value_type_copy()), if any. Actually we may need to store Eina_Value_Struct_Desc or Eina_Value_Type (subtype) for arrays/list/hash. Then Efl_Event_Description would contain 2 extra pointers: Eina_Value_Type **p_value_type; union { Eina_Value_Struct_Desc **p_struct_desc; Eina_Value_Type **p_subtype; }; Why 2 starts (pointer-of-pointer)? If we want to use EINA_VALUE_TYPE_INT and it's defined in libeina, we'd need to declare it as non-const and do runtime initialization. Using pointer-of-pointer eliminates that need, the linker will its work, but we need to dereference twice. (This problem was mentioned at "Eolian: Future + Eina_Value: multiple values", but there we can't change to double pointer otherwise we break the API. This is a new API, so we can choose another way to avoid that problem). -- 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 enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel