Yes, you're right, I'm wrong. :)
The derefs must be in the dosync block. (which I somehow assumed, oh well)

On Tue, Apr 26, 2011 at 11:17 PM, Daniel Werner <
[email protected]> wrote:

> On Apr 26, 10:52 pm, Jonathan Fischer Friberg <[email protected]>
> wrote:
> > No, that isn't possible.http://clojure.org/refs
>
> I disagree: In the example given, dereferencing happens outside the
> dosync block, thus outside of any transaction, so a race where map1
> and map2 change midway through the #'and expression is theoretically
> possible. For this reason, #'deref/@ and #'alter are best kept in the
> same transaction in this situation.
>
> > Inside a transaction (a dosync call), values updated in another
> transaction
> > wont be seen. This means that the first transaction wont see the change
> > until it commits, at that moment it realizes that the ref that were
> altered
> > was changed outside of that particular transaction, and retries. All of
> this
> > happens automatically, so you wont have to worry.
>
> --
> 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
>

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

Reply via email to