RecursiveTask and asynchronous waiting for completion

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RecursiveTask and asynchronous waiting for completion

JSR166 Concurrency mailing list
If has a RecursiveTask and on completion I need to take an action. However, I don't want to block the thread by calling task.join.

So how can one listen to the completion of a RecursiveTask and then take an action? So comparable like the CompletableFuture.thenApply.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest
Reply | Threaded
Open this post in threaded view
|

Re: RecursiveTask and asynchronous waiting for completion

JSR166 Concurrency mailing list
On 01/12/2018 06:27 AM, Peter Veentjer via Concurrency-interest wrote:
> If has a RecursiveTask and on completion I need to take an action.
> However, I don't want to block the thread by calling task.join.

You could use CountedCompleter rather than RecursiveTask.
It provides simple and efficient but hard-to-use completion chaining.
Or recast as CompletableFuture, which was introduced in part because
CountedCompleters are hard to use.

-Doug

>
> So how can one listen to the completion of a RecursiveTask and then take
> an action? So comparable like the CompletableFuture.thenApply.

_______________________________________________
Concurrency-interest mailing list
[hidden email]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest