Structured concurrency with runnables?
Remi Forax
forax at univ-mlv.fr
Thu May 11 16:44:45 UTC 2023
> From: "Eric Kolotyluk" <eric at kolotyluk.net>
> To: "loom-dev" <loom-dev at openjdk.org>
> Sent: Thursday, May 11, 2023 6:32:01 PM
> Subject: Re: Structured concurrency with runnables?
> Yes, that works, but it would be nice to skip the boilerplate and and just do
> scope.fork( new Runnable(...));
You have to choose what will be the default return value and choosing null is perhaps not the best default.
Rémi
> On 2023-05-11 9:15 a.m., Remi Forax wrote:
>>> From: "Josiah Noel" [ mailto:josiahnoel at gmail.com | <josiahnoel at gmail.com> ]
>>> To: "loom-dev" [ mailto:loom-dev at openjdk.org | <loom-dev at openjdk.org> ]
>>> Sent: Thursday, May 11, 2023 5:53:11 PM
>>> Subject: Structured concurrency with runnables?
>>> Would be nice if there was a variant of fork could take a Runnable. Turning my
>>> runnable tasks into Callable is relatively easy, but it's an inconvenience
>>> nonetheless.
>> Callable<Void> callable = Executors.callable(runnable, null);
>> regards,
>> Rémi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20230511/685812dd/attachment.htm>
More information about the loom-dev
mailing list