eina: add promise
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>
Fri, 1 Apr 2016 17:49:58 +0000 (14:49 -0300)
committerCedric Bail <cedric@osg.samsung.com>
Tue, 5 Apr 2016 18:35:12 +0000 (11:35 -0700)
commit09eea7bc01dd1381589eeab35e705cbd45820f1e
tree99fe671e347803af2052aede2d4f58f37768c416
parentaba46af602c8b45815974ed25303874e9a368c86
eina: add promise

Add a promise object that will allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.

To understand better, let see the coming usage in a .eo file:

class Foo {
   methods {
      bar {
         params {
            @inout promise: Promise<int>;
         }
      }
   }
}

Which will create the following API interface:

void foo_bar(Eo* obj, Eina_Promise** promise);

and the equivalent declaration for implementation.

However, the API function will instantiate the Promise for the user
and the implementer of the class automatically. So the user of this
function will treat it as a @out parameter, while the developer of the
function will treat it like a @inout parameter.

So, the user will use this function like this:

Eina_Promise* promise; // No need to instantiate
foo_bar(obj, &promise);
eina_promise_then(promise, callback);

Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
src/Makefile_Eina.am
src/lib/eina/Eina.h
src/lib/eina/eina_promise.c [new file with mode: 0644]
src/lib/eina/eina_promise.h [new file with mode: 0644]