[concurrency-interest] Write barrier in ArrayList.grow()

Roman Leventov leventov.ru at gmail.com
Wed Sep 12 06:08:26 EDT 2018

Why wouldn't ArrayList add a write barrier in it's grow() method between
the new elementData array population and the assignment of the elementData
field? It would cost almost nothing, but exclude an important class of
races, when one thread adds elements into an ArrayList, and other threads
read elements at small indexes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20180912/124955f2/attachment.html>

More information about the Concurrency-interest mailing list