Clojure STM ( dosync ) x Java synchronize block

后端 未结 4 1529
广开言路
广开言路 2021-02-14 05:36

What is the difference between Clojure STM (dosync) approach and Java synchronize Block?

I\'m reading the code below from \"The sleeping barber\" problem. (http://www.b

4条回答
  •  你的背包
    2021-02-14 05:53

    Also in addition to Michał's excellent answer, with STM transactions, reads always get you the frozen value at the beginning of the transaction and need not wait for any ongoing transaction to complete.

提交回复
热议问题