Completed
Details
Details
Assignee
Rich Hickey
Rich HickeyReporter
Rich Hickey
Rich HickeyLabels
Approval
Ok
Patch
Code and Test
Priority

Affects versions
Fix versions
Created August 25, 2014 at 3:09 PM
Updated October 7, 2014 at 10:46 PM
Resolved October 7, 2014 at 10:46 PM
Motivation:
Clojure needs a faster variant of Atom for managing state inside transducers. That is, Atoms do the job, but they provide a little too much capability for the purposes of transducers. Specifically the compare and swap semantics of Atoms add too much overhead. Therefore, it was determined that a simple volatile ref type would work to ensure basic propagation of its value to other threads and reads of the latest write from any other thread. While updates are subject to race conditions, access is controlled by JVM guarantees.
Solution overview: Create a concrete type in Java, akin to clojure.lang.Box, but volatile inside supports IDeref, but not watches etc.
API:
Patch: volatile3.diff
Screened by: fogus