On Fri, 9 Jun 2023 16:53:15 GMT, Andrew Haley <a...@openjdk.org> wrote:

> Move `runWith()` from `VirtualThread` to `BaseVirtualThread`.
> 
> `BoundVirtualThread` does not use `runWith()` to run its task, so when a VM 
> error occurs it can not recover scoped values.
> 
> Moving `runWith()` into the common subclass of both `VirtualThread` and 
> `BoundVirtualThread` fixes the problem.

src/java.base/share/classes/java/lang/BaseVirtualThread.java line 78:

> 76:         op.run();
> 77:         Reference.reachabilityFence(bindings);
> 78:     }

BaseVirtualThread <: Thread.  Would it be simpler, and avoid duplicate, to just 
change Thread.runWith to be a final method with default access. That would be 
accessibility to VirtualThread and BoundVirtualThread without duplication.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14399#discussion_r1224563933

Reply via email to