Lock Upgrading

"Dr Heinz M. Kabutz via Concurrency-interest" <[email protected]> Fri, 29 May 2020 00:09:10 +0300
Newsgroups gmane.comp.java.jsr.166-concurrency
Organization JavaSpecialists.eu
Message-ID <[email protected]>
Some of you might enjoy today's Java Specialists Newsletter:

https://www.javaspecialists.eu/archive/Issue279.html

Title: Upgrading ReadWriteLock

Abstract: The Java ReentrantReadWriteLock can never ever upgrade a read 
lock to a write lock. Kotlin's extension function 
ReentrantReadWriteLock.write() cheats a bit by letting go of the read 
lock before upgrading, thus opening the door for race conditions. A 
better solution is StampedLock, which has a method to try to convert the 
lock to a write lock.


Regards

Heinz
-- 
Dr Heinz M. Kabutz (PhD CompSci)
Author of "The Java™ Specialists' Newsletter" - www.javaspecialists.eu
Java Champion - www.javachampions.org
JavaOne Rock Star Speaker
Tel: +30 69 75 595 262
Skype: kabutz

_______________________________________________
Concurrency-interest mailing list
[email protected]
http://cs.oswego.edu/mailman/listinfo/concurrency-interest