문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top