[External] : Re: Future.resultNow / exceptionNow
Ron Pressler
ron.pressler at oracle.com
Mon Nov 22 22:56:57 UTC 2021
> On 22 Nov 2021, at 21:44, Alex Otenko <oleksandr.otenko at gmail.com> wrote:
>
> Correct, hence the fuss around state != SUCCESS for the opposite condition.
>
> As for examples of when you'd need this - I think commonly I want to start processing the responses as soon as they start arriving, not wait for them all to complete.
>
> Maybe in this brave new world things just get expressed differently, but I would need something like "wait for the first" (that's "any" semantics), process, then "wait for the next", etc. Processing like this is more efficient than waiting for all, then process all, and less complex than processing each response in the task, as there is no concurrency in sequential processing of responses.
>
> Alex
Have the completion handler (or the task itself) place the result into a blocking queue that you will then consume from the parent. There’s no need to poll futures.
— Ron
More information about the loom-dev
mailing list