Clojure STM与原子和代理形式有关系吗? [英] Does Clojure STM has a relationship with atom and agent forms?

查看:126
本文介绍了Clojure STM与原子和代理形式有关系吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究Clojure中的并发编程。
http://clojure.org/concurrent_programming

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.

只有 ref 用于协调更新,因此在执行更改时使用 dosync 宏。

Only ref is used for coordinated updates , so dosync macro is used when performing changes.

所以很明显,STM引擎在这一点上涉及。

So it is obvious that STM engine is involved at this point.

只是想清楚下面的怀疑我有,

Just wanted to be clear about following doubt I have,


Clojure STM与原子和代理表单是否有关系?或者
他们只是使用了java.util.concurrent.atomic功能?

Does Clojure STM has a relationship with atom and agent forms too? or are they just utilized java.util.concurrent.atomic capabilities ?


推荐答案

STM与代理相关,发送发送 send-via dosync 块中调用时,只会生效一次(且如果)事务成功提交。

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.

STM和原子之间没有关系。

There is no relationship between the STM and Atoms.

这篇关于Clojure STM与原子和代理形式有关系吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆