On Tue, 22 Jul 2025 05:47:37 GMT, David Holmes <dhol...@openjdk.org> wrote:

>> The `cv_internal_thread_to_JavaThread` method will now check if the thread 
>> is a mounted virtual thread, and if so protect the carrier thread. User's of 
>> the API that need to deal with virtual threads must still check the carrier 
>> themselves as it could change asynchronously, but it is now guaranteed that 
>> the carrier JavaThread returned via this method cannot terminate whilst 
>> being used (the same as regular platform JavaThreads).
>> 
>> It was noticed whilst updating the documentation that the `JvmtiExport` 
>> variant `cv_oop_to_JavaThread` is unused and so can be removed.
>> 
>> Testing:
>> - tiers 1-4
>> 
>> Thanks
>
> David Holmes has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Move comment

I still think that it would be safer to explicitly specify that caller knows 
that jthread can be virtual thread (and maybe add assert when a caller works 
only with platform threads, but passed jthread is virtual), but ok, it's up to 
you.
Currently all callers except `ThreadSnapshotFactory::get_thread_snapshot` use 
`cv_internal_thread_to_JavaThread` for platform threads only. Do you want to 
update `ThreadSnapshotFactory::get_thread_snapshot` to utilize new 
functionality or prefer to do it by separate CR?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26287#issuecomment-3104940720

Reply via email to