If yielding fails due to the pinning then VirtualThread.parkNanos parks on the carrier thread with the remaining time. The calculation of the remaining time needs to be replaced so that it obviously uses the difference between the start and end time in the calculation. The current code isn't correct for cases where System.nanoTimes return a negative value or when parking for durations close to Long.MAX_VALUE (292 years). The change isn't really testable so there aren't any test changes included.
------------- Commit messages: - .swp checked in accidently - Initial commit Changes: https://git.openjdk.org/jdk/pull/15405/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15405&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8314759 Stats: 4 lines in 1 file changed: 0 ins; 2 del; 2 mod Patch: https://git.openjdk.org/jdk/pull/15405.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/15405/head:pull/15405 PR: https://git.openjdk.org/jdk/pull/15405