Depends on D8333
Okay, my question more clear: This future here in a eina value can also be just something else, since this future will not be assosiated with the promise that is resolved so _eio_build_mime_now is executed.
So it does just return a new future that will be resolved later using another job. The future as value actually is understood by the logic of Eina_Future and automatically plug this new future in the chain and will wait on it to resolve before continuing the chain. I am pretty sure I am hurting your brain again :-)
Oh, that's because there is no EINA_VALUE_TYPE_FUTURE only EINA_VALUE_TYPE_PROMISE. If you look at the code of eina_future_as_value in eina_promise.c, you will see how things are hooked via an intermediate promise.
I don't know. It does take an Eina_Future and make it an Eina_Value. There is just some magic plumbing inside. I don't know if the user of the function has to know much about that magic.
First off, thank you both for giving my brain the opportunity to hurt so much.
So, there is a method called eina_promise_as_value() which takes an Eina_Promise and wraps it in an Eina_Value.
And then there is eina_future_as_value() which indeed takes an Eina_Future and produces an Eina_Value. The mechanism, though, is obscure to me and I would appreciate an explanation. A proxy promise is created, and another callback is attached to the original future... but I get lost.
At any rate, eina_promise_as_value is very simple, whereas eina_future_as_value seems to be doing a lot of things. So yeah, until I understand better what is going on, I also think that "future as value" is misleading.
You are welcome :-)
The idea for propagating a future into an Eina_Value without duplicating logic and adding a new type is to actually create a promise and put that into the Eina_Value. Then setting up a callback on the Eina_Future that was given and when it resolve manually trigger a resolve on the promise that was set inside the Eina_Value. This is like a manual pipe to get things across. Of course if the Eina_Value is freed, then it will cancel the callback. I hope this help.