RFR: 8338417: Explicitly pin a virtual thread before acquiring the JFR string pool monitor [v3]
Erik Gahlin
egahlin at openjdk.org
Thu Aug 15 14:20:49 UTC 2024
On Thu, 15 Aug 2024 12:26:38 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Markus Grönlund has updated the pull request incrementally with one additional commit since the last revision:
>>
>> update test comment
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.java line 86:
>
>> 84:
>> 85: private static void unpinVirtualThread() {
>> 86: if (Thread.currentThread().isVirtual() && ContinuationSupport.isSupported()) {
>
> If you are at all concerned about overhead here then pin could return a boolean to indicate if the pin happened and oyu could then unpin just by checking that boolean and avoid doing the isVirtual and isSupported checks again.
Would it be possible to create a boolean in the EventWriter that indicates if it is associated with a carrier thread or a normal thread (which can never be virtual) and then have two methods.
long l = this.carrierThread ? StringPool.addPinnedString(s) : StringPool.addString(s);
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20588#discussion_r1718464765
More information about the core-libs-dev
mailing list