Thanks Michal, those annotations helped quite a bit. It also demonstrates to me that my mental model of how the STM works is quite out of touch with how it actually does.
I'm especially surprised that derefs work the way your example illustrates. >From the STM docs, it really sounded like derefs always give you the value as of the snapshot from the start of the transaction. Your example also seems to violate this principle from the STM doc: "Writers will never block commuters, or readers." Your example shows that a write to a ref has effectively blocked (by forcing a retry) of a transaction which only reads the ref. If derefs really can force a retry, can't Meikel's example be rewritten without ensure by just deref-ing again at the end?... (dosync (when (= @reactor-state :off) (alter reactor-door open) @reactor-state)) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en
