On Tue, Jul 17, 2012 at 4:58 PM, Warren Lynn <wrn.l...@gmail.com> wrote:
>
>
> On Tuesday, July 17, 2012 7:50:10 PM UTC-4, red...@gmail.com wrote:
>>
>> if you do it as a lock, then readers must block writers (think it
>> through). Clojure's reference types + immutable datastructures and the
>> views on perception that underlay them are strongly opposed to readers
>> interfering with writers.
>>
>>
>
> Why is it so? Does not the reader just get a snapshot copy of the atom state
> and does not care who writes to the original atom? If a lock is needed, it
> is only needed for a very short commit time (cannot read when a writer is
> committing), but not during the whole "swap!" function. That still sounds a
> lot better than re-try to me.

Finish the thought, what happens when there is "contention", a thread
reads then writes before you acquire the lock to commit. You can try
and making locking work, but you'll just up with CAS based on a lock

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



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

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