↧
Answer by Jarlax for Race condition in Clojure stm?
Let's look at example:(defn test-trans [] (let [x (ref 1) t-inc #(dosync (alter x inc)) t-mul #(dosync (alter x (partial * 2))) fns (flatten (repeat 10 [t-mul t-inc]))] (last (pmap (fn [f] (f)) fns))...
View ArticleRace condition in Clojure stm?
Hello I was reading the book joy of clojure and in the section about the STM they have an image of 2 transactions where A is initially retrieving the same value from a ref as B is and then both...
View Article