A struct used to define a callback and data for a future. More...
#include <eina_promise.h>
Data Fields | |
Eina_Future_Cb | cb |
Called when the future is resolved or rejected. More... | |
const void * | data |
Context data to cb . More... | |
Eina_Future ** | storage |
The storage will be used by Eina to store a pointer to the created future. More... | |
A struct used to define a callback and data for a future.
This struct contains a future completion callback and a data to the future completion callback which is used by eina_future_then(), eina_future_chain() and friends to inform the user about the future result. The _Eina_Future_Desc::data variable should be freed when _Eina_Future_Desc::cb is called, otherwise it will leak.
NULL
is returned) the _Eina_Future_Desc::cb will be called report an error like EINVAL
or ENOMEM
so _Eina_Future_Desc::data can be freed.Eina_Future_Cb _Eina_Future_Desc::cb |
Called when the future is resolved or rejected.
Once a future is resolved or rejected this function is called passing the future result to inform the user that the future operation has ended. Normally this function is called from a safe context (main loop or some platform defined safe context), however in case of a future cancellation (eina_future_cancel()) or if eina_future_then(), eina_future_chain() and friends fails to create a new future, this function is called from the current context.
Use this function to free data
if necessary.
Referenced by eina_future_cb_console_from_desc(), eina_future_cb_convert_to(), eina_future_chain_array(), and eina_future_new().
const void* _Eina_Future_Desc::data |
Context data to cb
.
The data
should be freed inside cb
, otherwise its memory will leak!
Referenced by eina_future_cb_console_from_desc().
Eina_Future** _Eina_Future_Desc::storage |
The storage will be used by Eina to store a pointer to the created future.
It can be NULL
.