On Mon, Aug 3, 2009 at 5:44 AM, Christophe Grand<christo...@cgrand.net> wrote:
> I think Mark's code exhibits a bug:
>
> (def my-ref (ref 1))
>
> (dosync
>   (ref-set my-ref 5)
>   (commute my-ref inc)) ; returns 6
>
> (println "my-ref =" @my-ref) ; prints 7
>
> since my-ref is ref-set, my-ref is in LockingTransaction/sets but its
> current value in LockingTransaction/vals is set by commute to 6.
> At the commit point, the commute function is rerun with the latest
> in-transaction value (6) and then 7 is committed...
>
> See the attached patch for a potential fix.
>

Patch applied to master and 1.0.x - thanks!

Rich

--~--~---------~--~----~------------~-------~--~----~
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