Referring to http://clojure.org/refs :
Rule 1. states that all your reads will be consistent as of the starting point of the transaction Rule 2. states that no changes will have been made by any other transactions to any Refs that have been *ref-set**/altered**/ensured* by this transaction. So by re-reading this page, I'm now pretty sure that you will have to call ensure to guarantee what you stated below. HTH, -- Laurent 2009/4/2 Korny Sietsma <ko...@sietsma.com> > Hmm - I'm unclear. I had the impression that if thread a *reads* ref > "world" and thread b *alters* ref "world" that would cause one of them to > retry... is that wrong? It probably doesn't matter to my code, but it'd be > good to know. > > - Korny > > > On Thu, Apr 2, 2009 at 6:11 PM, Laurent PETIT <laurent.pe...@gmail.com>wrote: > >> Hello, >> >> 2009/4/2 Korny Sietsma <ko...@sietsma.com> >> >>> >>> If I understand correctly, two threads calling do_something_to with >>> different keys won't collide, as they read @world but don't change it. I'll >>> get a collision if one thread changes @world and another changes an >>> individual structure - but I guess that's necessary, as the change might >>> have deleted the record with the key needed by the other thread. >> >> >> I'm far from a specialist of these aspects of clojure, but I'm not sure >> you're right when you say you will get a collision. I think you will not >> have a collision, unless you call (ensure) on the world ? >> >> >> >> > > > -- > Kornelis Sietsma korny at my surname dot com > "Every jumbled pile of person has a thinking part > that wonders what the part that isn't thinking > isn't thinking of" > > > > --~--~---------~--~----~------------~-------~--~----~ 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 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 -~----------~----~----~----~------~----~------~--~---