On Fri, 9 Jun 2023 17:19:42 GMT, Alan Bateman <al...@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 code, > to just change Thread.runWith to be a final method with default access. That > would be accessible to VirtualThread and BoundVirtualThread without needing > to override runWith. Sure, that makes sense. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14399#discussion_r1225234193