> Thread::getState is an API for monitoring and management purposes to report > the thread state. If a virtual thread is parked with LockSupport.parkNanos, > its state is reported as WAITING when it should be TIMED_WAITING. JVM TI > GetThreadState has the same issue in that it returns > JVMTI_THREAD_STATE_WAITING_INDEFINITELY instead of the > JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT bit set. Not a very visible issue > with debuggers because JDWP maps both states to "WAIT" but it may be noticed > by tools using other JVM TI agents. > > The change is straight-forward with additional state for > timed-parking/parked/pinned. The existing virtual/ThreadAPI.java test is > expanded to this scenario. A new test is added for JVM TI GetThreadState to > test waiting/timed-waited cases (including pinned) as test coverage seems > patchy here.
Alan Bateman has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision: - Merge - Reorder getState tests, use assertEquals and misc. cleanup - Merge - Merge - Revert back to explicit TIMED_xxx states - Merge - Merge - Merge - Remove unecessary RF from test - Merge - ... and 7 more: https://git.openjdk.org/jdk/compare/5a10d32c...ac8da3e5 ------------- Changes: - all: https://git.openjdk.org/jdk/pull/14978/files - new: https://git.openjdk.org/jdk/pull/14978/files/70b7766d..ac8da3e5 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=14978&range=03 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=14978&range=02-03 Stats: 43518 lines in 857 files changed: 8140 ins; 4569 del; 30809 mod Patch: https://git.openjdk.org/jdk/pull/14978.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/14978/head:pull/14978 PR: https://git.openjdk.org/jdk/pull/14978