Should multiple Clojure refs read a transaction for consistency?

This is a theoretical question, motivated by my desire to better understand Clojure concurrency.

Say I'm writing boids. Suppose each boid is a separate green thread, mutating positions in a vector or refs, representing a grid of the world. Think of a Hiki ant colony.

Now the documentation at Clojure.org states: "All Refs reads will see a consistent Ref world snapshot at the start of the transaction (its" read point ").

Does this mean that I can get a consistent snapshot of my simulation, for example, to draw it by reading my link vector in a transaction (i.e. in the context of dosync?)

Thank!

+5
source share
1 answer

, .

, , . , , .

+6

All Articles