On Tue, May 31, 2016 at 4:45 PM, Carsten Haitzler <ras...@rasterman.com>
wrote:
> On Tue, 31 May 2016 06:15:29 -0700 Cedric BAIL <cedric.b...@free.fr> said:
>
>> On May 30, 2016 22:51, "Carsten Haitzler" <ras...@rasterman.com> wrote:
>> >
>> > the api for promises seems pretty confusing. just look at this:
>> >
>> > job = efl_loop_job(obj, args);
>> > eina_promise_then(job, _efl_loop_args_job_cb, NULL, args);
>> >
>> > why do i need to pass in args... TWICE? well ok - this specific way of
>> using
>> > promises for jobs... both promises in efl_loop.eo do this, and it's
>> confusing.
>> > the void *data when creating the job (first args) is not used at all.
the
>> data
>> > for the promise is passed as data to the promise callback.
>> >
>> > why do this? value isn't used here in the promise -actually it's the
>> promise
>> > ptr itself for whatever reason.
>>
>> They are both different. A promise deliver a value at some point in the
>> future to multiple callback couple. The data you give when creating the
>> promise is the one delivered in the future. The one you pass with your
>> couple of callbacks is obviously tied to that couple of callback. They
are
>> clearly 2 different things. Obviously you don't need to pass any data at
>> all in both case.
>
> ummm the void *data when creating the job never is passed as anything to
> promise callbacks. why have it at all? it's misleading. it's useless. i
sat
> down and had to figure out what is and isn't passed because it was
entirely
> unclear what was passed or not. value is the promise. i've printfed it's
values
> trying to figure out what gets passed where. bizarre that it is but
whatever.
> but data from the job is unused. data from the eina_promise_then is used
and
> passed as data to the cb's

It is passed as the value. The second parameter of the function being
called in the then case. You did set it to EINA_UNUSED in your case. I can
call it value in the .eo if that help.
-- 
Cedric BAIL
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to