On Wed, 21 Apr 2021 04:36:07 GMT, David Holmes <[email protected]> wrote:
>> When going to blocked inside the async handshake we **must** unlock the
>> HandshakeState lock.
>> Thus _lock.wait() unlocks and gives us something to notify.
>> We could do:
>>
>> _lock.unlock();
>> {
>> MutexLocker(SomeOtherLock) ml;
>> SomeOtherLock.wait();
>> }
>> _lock.lock();
>>
>>
>> Another alternative is to create a friend class which uses the
>> HandshakeState lock and having the API there instead.
>
> Borrowing the HandshakeState lock does create an artificial coupling here.
> I'd prefer to see this API in a more natural place with friendship used to
> access the mechanism as needed. Future cleanup though.
Also I think you'd have a lost-wakeup problem if two locks were involved.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3191