<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 12/4/23 5:20 AM, Alan Bateman wrote:<br>
</div>
<blockquote type="cite" cite="mid:5efb2178-fec7-4cd1-a752-45514d5538b5@oracle.com">
<br>
<br>
<div class="moz-cite-prefix">On 04/12/2023 12:41, David Holmes
wrote:<br>
</div>
<blockquote type="cite" cite="mid:72662e8e-342a-4812-9f5d-4002d7810dd9@oracle.com">On
1/12/2023 2:08 pm, Alex Menkov wrote: <br>
<blockquote type="cite">On Thu, 30 Nov 2023 21:11:08 GMT, Chris
Plummer <a class="moz-txt-link-rfc2396E" href="mailto:cjplummer@openjdk.org" moz-do-not-send="true"><cjplummer@openjdk.org></a>
wrote: <br>
<br>
<blockquote type="cite">I wasn't thinking in terms of the
scheduler somehow no longer references the virtual thread,
but instead the program no longer referencing the scheduler
(and also not referencing the virtual thread). <br>
</blockquote>
<br>
AFAIU unfinished unmounted virtual threads are referenced from
other objects (they are parked on), so they can't be
unreachable even is the application is not referencing them
and the scheduler. <br>
</blockquote>
<br>
There is (or was - there may be a property that affects this:
trackAllThreads?) a scenario where a VT might park on a
synchronization object which is not referenced from any other
thread. The VT can never be unparked, and the sync object and
the VT are reachable only from either other and so both can be
GC'd.</blockquote>
<br>
That's right, the door is not closed to introducing <span style="color: rgb(29, 28, 29); font-family: Slack-Lato, Slack-Fractions, appleLogo, sans-serif; font-size: 15px; font-style: normal; font-variant-ligatures: common-ligatures; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">ephemeral
threads in the future. Right now, virtual threads created
directly with the Thread API remaining strongly reachable once
started until they terminate. Virtual threads created in other
containers (e.g. a thread-per-task ExecutorService) are kept
reachable by the container.<br>
<br>
-Alan<br>
</span></blockquote>
<p>So does this mean if the application is no longer referencing the
ExecutorService, then we can have unreachable virtual threads that
have not completed? This is really the point I've been getting at.</p>
<p>Chris<br>
</p>
</body>
</html>