On 15 March 2010 21:08, Meikel Brandmeyer <m...@kotka.de> wrote:
> Now I'm confused. Calling ensure on r shouldn't have an effect since we
> call alter on r anyway, no?

ensure "protects the ref from modification by other transactions"
(from the docs). alter does not.

Reading into the Java code, ensure puts a lock on the ref, which, once
in place, guarantees that the transaction doing the ensuring has an
exclusive right to modify the ref until it commits / retries... or
something, my Java-fu is still nothing to boast about, regrettably.

At any rate, my current understanding is that, in Garth's example, the
ensure gives (alter r f) all the time it needs to modify r's value
while putting all other transactions which attempt to modify r on
hold. alter, by itself, never interferes with background transactions;
should something disappear from under its feet, it expects to be
retried.

Ok, back to improving my Java chops in the hope of grasping all the
intricasies of Rich's code sometime... *sigh*

Sincerely,
Michał

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