Integrated: 8378268: Thread.join can wait on Thread, allows joinNanos to be removed

Alan Bateman alanb at openjdk.org
Thu Feb 26 13:41:30 UTC 2026


On Fri, 20 Feb 2026 09:26:52 GMT, Alan Bateman <alanb at openjdk.org> wrote:

> Thread.join was historically implemented with a loop of Object.wait conditioned on isAlive. We couldn't for this virtual threads because it would pin a virtual thread invoking join to it carrier.  Now that Object.wait preempts, it means the special implementation of join for virtual threads can be removed. Where possible, the notifyAll is elided as it adds to the cost of termination.
> 
> The implNote of the join methods is restored (this is implNote text, not spec, so no CSR required).
> 
> Testing: tier1-5

This pull request has now been integrated.

Changeset: b13a2916
Author:    Alan Bateman <alanb at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/b13a291667535fdea30936ea5dc87f405e637069
Stats:     86 lines in 2 files changed: 10 ins; 64 del; 12 mod

8378268: Thread.join can wait on Thread, allows joinNanos to be removed

Reviewed-by: jpai, vklang

-------------

PR: https://git.openjdk.org/jdk/pull/29839


More information about the core-libs-dev mailing list