Lock Upgrading

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Lock Upgrading

JSR166 Concurrency mailing list
Some of you might enjoy today's Java Specialists Newsletter:


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.


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
[hidden email]