<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div><br></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Eric Kolotyluk" <eric@kolotyluk.net><br><b>To: </b>"loom-dev" <loom-dev@openjdk.org><br><b>Sent: </b>Thursday, May 11, 2023 6:32:01 PM<br><b>Subject: </b>Re: Structured concurrency with runnables?<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p>Yes, that works, but it would be nice to skip the boilerplate and
and just do</p>
<p>scope.fork( new Runnable(...));</p></blockquote><div><br></div><div>You have to choose what will be the default return value and choosing null is perhaps not the best default.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Rémi<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><p><br>
</p>
<div class="moz-cite-prefix">On 2023-05-11 9:15 a.m., Remi Forax
wrote:<br>
</div>
<blockquote cite="mid:1557617385.53826484.1683821716240.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">
<div><br>
</div>
<div><br>
</div>
<hr id="zwchr">
<div>
<blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
</b>"Josiah Noel" <a class="moz-txt-link-rfc2396E" href="mailto:josiahnoel@gmail.com" target="_blank"><josiahnoel@gmail.com></a><br>
<b>To: </b>"loom-dev" <a class="moz-txt-link-rfc2396E" href="mailto:loom-dev@openjdk.org" target="_blank"><loom-dev@openjdk.org></a><br>
<b>Sent: </b>Thursday, May 11, 2023 5:53:11 PM<br>
<b>Subject: </b>Structured concurrency with runnables?<br>
</blockquote>
</div>
<div>
<blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
<div dir="auto">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.</div>
</blockquote>
<div><br>
</div>
Callable<Void> callable = Executors.callable(runnable,
null);
<div><br>
</div>
<div>regards,<br>
</div>
<div>Rémi<br>
</div>
<div><br>
</div>
</div>
</div>
</blockquote><br></blockquote></div></div></body></html>