RFR: 8257831: Suspend with handshakes [v10]
David Holmes
dholmes at openjdk.java.net
Wed Apr 21 04:42:27 UTC 2021
On Wed, 21 Apr 2021 04:36:07 GMT, David Holmes <dholmes at openjdk.org> 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
More information about the hotspot-runtime-dev
mailing list