Quantcast
Channel: Race condition in Clojure stm? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Race condition in Clojure stm?

$
0
0

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 transaction A and B does their calculations but A finishes first and makes the commit to the variable and thus B must retry.

But what I am pondering about is if B would have retried with A's commit. And if that is the case then what if it where the opposite? Then the final value would be significally different.

This seems to simple of a hazard to have been overlooked,and I believe I don't understand it completely. Please help me untangle this.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images