Integrated: 8309545: Thread.interrupted from virtual thread needlessly resets interrupt status
Alan Bateman
alanb at openjdk.org
Fri Jun 9 07:32:49 UTC 2023
On Wed, 7 Jun 2023 15:12:40 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Thread.interrupted is used to "get and clear" the current thread's interrupt status. When called from a virtual thread, the current implementation always clears the carrier's interrupt status. There is no need to do this when the interrupt status is not set, it can just read the interrupt status and return false in that case.
>
> This was found by Sergey Kuksenko when comparing platform vs. virtual thread performance. Once CODETOOLS-7903476 is in a released version of JMH then we can start to accumulate benchmarks that execute in virtual threads.
>
> Testing: tier1-5
This pull request has now been integrated.
Changeset: 97df6cf5
Author: Alan Bateman <alanb at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/97df6cf55ab66552612bf0a2eefb83c0783fd586
Stats: 6 lines in 1 file changed: 1 ins; 0 del; 5 mod
8309545: Thread.interrupted from virtual thread needlessly resets interrupt status
Reviewed-by: rpressler, dholmes, jpai
-------------
PR: https://git.openjdk.org/jdk/pull/14361
More information about the core-libs-dev
mailing list