eina: add eina_promise_data_set symetric to eina_promise_data_get.

This commit is contained in:
Cedric BAIL 2017-09-11 16:09:43 -07:00
parent 54083a7835
commit fa9acf8b35
2 changed files with 20 additions and 0 deletions

View File

@ -998,6 +998,15 @@ eina_promise_data_get(const Eina_Promise *p)
return (void *)p->data;
}
EAPI void
eina_promise_data_set(Eina_Promise *p,
void *data)
{
EINA_SAFETY_ON_NULL_RETURN(p);
p->data = data;
}
static Eina_Value
_eina_future_cb_easy(void *data, const Eina_Value value,
const Eina_Future *dead_future)

View File

@ -553,6 +553,17 @@ EAPI Eina_Promise *eina_promise_new(Eina_Future_Scheduler *scheduler, Eina_Promi
*/
EAPI void *eina_promise_data_get(const Eina_Promise *p) EINA_ARG_NONNULL(1);
/**
* Sets the data attached to the promise.
*
* Set the data passed to eina_promise_new().
* @see eina_promise_new()
* @see eina_promise_resolve()
* @see eina_promise_reject()
* @see eina_promise_as_value()
*/
EAPI void eina_promise_data_set(Eina_Promise *p, void *data) EINA_ARG_NONNULL(1);
/**
* Resolves a promise.
*