On Tue, 22 Oct 2024 12:31:24 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Okay but ....
>> 1. We have the current virtual thread
>> 2. We have the current carrier for that virtual thread (which is iotself a 
>> java.alng.Thread object
>> 3. We have Thread.setCurrentLockId which ... ? which thread does it update? 
>> And what does "current" refer to in the name?
>
> Thread identity switches to the carrier so Thread.currentThread() is the 
> carrier thread and JavaThread._lock_id is the thread identifier of the 
> carrier.  setCurrentLockId changes JavaThread._lock_id back to the virtual 
> thread's identifier.

If the virtual thread is un-mounting from the carrier, why do we need to set 
the "lock id" back to the virtual thread's id? Sorry I'm finding this quite 
confusing.

Also `JavaThread::_lock_id` in the VM means "the java.lang.Thread thread-id to 
use for locking" - correct?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21565#discussion_r1811877637

Reply via email to