I am looking into the Concurrency programming in Clojure . http://clojure.org/concurrent_programming
I got to know that atom, ref and agent forms are used to maintain program state.
Only ref is used for coordinated updates , so dosync macro is used when performing changes.
So it is obvious that STM engine is involved at this point.
Just wanted to be clear about following doubt I have,
Does Clojure STM has a relationship with atom and agent forms too? or are they just utilized java.util.concurrent.atomic capabilities ?
The STM is related to Agents in that send
, send-off
and send-via
, when called inside a dosync
block, only take effect once (and if) the transaction successfully commits.
There is no relationship between the STM and Atoms.