-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix virtual thread interrupts #18989
Conversation
@JasonFengJ9 Can you please review this change? It is related to OJDK's Thread impl. |
Also, requesting @tajila for a review. |
806dfa5
to
a99b9fd
Compare
In JDK19+, multiple thread objects can be associated to a J9VMThread: a virtual thread and its carrier thread. If a virtual thread is mounted, then the carrier thread is unmounted and vice-versa. In such cases, J9VMThread's state should not be used to determine if a thread object is interrupted. Instead, Thread.interrupted is used to determine if a thread object is interrupted. If a mounted thread is suspended, only set Thread.interrupted to TRUE and do not wake/interrupt the thread. This behaviour is expected in GetThreadStateMountedTest, which is a test added for virtual threads in JDK22. These changes are only added for virtual threads in JDK19+. Related: eclipse-openj9#18810 Signed-off-by: Babneet Singh <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jenkins test sanity alinux64 jdk21 |
jenkins test sanity win jdk8 |
The Windows test build failed due to #18998: |
Depends on eclipse-openj9/openj9#18989 Closes: eclipse-openj9/openj9#18810 Signed-off-by: Babneet Singh <[email protected]>
Depends on eclipse-openj9/openj9#18989 Closes: eclipse-openj9/openj9#18810 Signed-off-by: Babneet Singh <[email protected]>
In JDK19+, multiple thread objects can be associated to a J9VMThread:
a virtual thread and its carrier thread.
If a virtual thread is mounted, then the carrier thread is unmounted and
vice-versa. In such cases, J9VMThread's state should not be used to
determine if a thread object is interrupted.
Instead, Thread.interrupted is used to determine if a thread object is
interrupted.
If a mounted thread is suspended, only set Thread.interrupted to TRUE
and do not wake/interrupt the thread. This behaviour is expected in
GetThreadStateMountedTest
, which is a test added for virtual threadsin JDK22. These changes are only added for virtual threads in JDK19+.
Related: #18810