diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2017-09-11 16:09:43 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-09-11 16:09:43 -0700 |
commit | fa9acf8b356b4e6d5ae899770b64f98e1f1a67f0 (patch) | |
tree | 72b15c51d3ce667098ae1d8eb85aeb00919dd4d3 | |
parent | 54083a7835af895d32b230d3f8d4c70aa2798773 (diff) | |
download | efl-fa9acf8b356b4e6d5ae899770b64f98e1f1a67f0.tar.gz |
eina: add eina_promise_data_set symetric to eina_promise_data_get.
-rw-r--r-- | src/lib/eina/eina_promise.c | 9 | ||||
-rw-r--r-- | src/lib/eina/eina_promise.h | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/eina/eina_promise.c b/src/lib/eina/eina_promise.c index 1cbc9f274f..1fbac60f65 100644 --- a/src/lib/eina/eina_promise.c +++ b/src/lib/eina/eina_promise.c @@ -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) diff --git a/src/lib/eina/eina_promise.h b/src/lib/eina/eina_promise.h index 9c8fc3a8a2..caca9574a9 100644 --- a/src/lib/eina/eina_promise.h +++ b/src/lib/eina/eina_promise.h @@ -554,6 +554,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. * * |