<div dir="ltr">I'm not convinced this helps.<div><br></div><div>The isAlive() spec says:</div><div><br></div><div>"A thread is alive if it has been started and has not yet terminated."<br></div><div><br></div><div>Clearly an object is reachable if it can be accessed by a thread that will be started in the future. Is that part of a "potential continuing computation from any live thread"?</div><div><br></div><div>I think the JLS wording is a bit sloppy about what "live thread" means here. And that sloppiness is probably better than pointing at a precise definition that I'm not sure really applies. "in any potential continuing computation from any live thread" really seems to mean something like "in any continuing computation in which no finalizers are run"?</div><div><br></div><div>Even if the object is later accessed from an existing "live" thread, it should not be considered reachable if that happens only after a finalizer later makes it reachable again. So I don't see why the thread from which the access happens matters at all.</div><div><br></div><div>Hans</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 9, 2024 at 11:44 AM Brent Christian <<a href="mailto:bchristi@openjdk.org">bchristi@openjdk.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Classes in the `java.lang.ref` package would benefit from an update to bring the spec in line with how the VM already behaves. The changes would focus on _happens-before_ edges at some key points during reference processing.<br>
> <br>
> A couple key things we want to be able to say are:<br>
> - `Reference.reachabilityFence(x)` _happens-before_ reference processing occurs for 'x'.<br>
> - `Cleaner.register()` _happens-before_ the Cleaner thread runs the registered cleaning action.<br>
> <br>
> This will bring Cleaner in line (or close) with the memory visibility guarantees made for finalizers in [JLS 17.4.5](<a href="https://docs.oracle.com/javase/specs/jls/se18/html/jls-17.html#jls-17.4.5" rel="noreferrer" target="_blank">https://docs.oracle.com/javase/specs/jls/se18/html/jls-17.html#jls-17.4.5</a>):<br>
> _"There is a happens-before edge from the end of a constructor of an object to the start of a finalizer (§12.6) for that object."_<br>
<br>
Brent Christian has updated the pull request incrementally with one additional commit since the last revision:<br>
<br>
add link to Thread.isAlive()<br>
<br>
-------------<br>
<br>
Changes:<br>
- all: <a href="https://git.openjdk.org/jdk/pull/16644/files" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/16644/files</a><br>
- new: <a href="https://git.openjdk.org/jdk/pull/16644/files/5db47889..4efa5d18" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/16644/files/5db47889..4efa5d18</a><br>
<br>
Webrevs:<br>
- full: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=16644&range=30" rel="noreferrer" target="_blank">https://webrevs.openjdk.org/?repo=jdk&pr=16644&range=30</a><br>
- incr: <a href="https://webrevs.openjdk.org/?repo=jdk&pr=16644&range=29-30" rel="noreferrer" target="_blank">https://webrevs.openjdk.org/?repo=jdk&pr=16644&range=29-30</a><br>
<br>
Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod<br>
Patch: <a href="https://git.openjdk.org/jdk/pull/16644.diff" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/16644.diff</a><br>
Fetch: git fetch <a href="https://git.openjdk.org/jdk.git" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk.git</a> pull/16644/head:pull/16644<br>
<br>
PR: <a href="https://git.openjdk.org/jdk/pull/16644" rel="noreferrer" target="_blank">https://git.openjdk.org/jdk/pull/16644</a><br>
</blockquote></div>