I have a hard time understanding why there is a need to retry when doing 
"swap!" on an atom. Why does not Clojure just lock the atom up-front and do 
the update? I have this question because I don't see any benefit of the 
current "just try and then re-try if needed" (STM?) approach for atom 
(maybe OK for refs because you cannot attach a lock to unknown ref 
combinations in a "dosync" clause). Right now I have an atom in my program 
and there are two "swap!" functions on it. One may take a (relatively) long 
time, and the other is short. I don't want the long "swap!" function to 
retry just because in the last minute the short one sneaked in and changed 
the atom value. I can do the up-front lock myself, but I wonder why this is 
not already so in the language. Thank you for any enlightenment.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to