On Thu, Sep 17, 2009 at 11:12 AM, John Harrop <jharrop...@gmail.com> wrote:
> On Thu, Sep 17, 2009 at 11:04 AM, Mark Volkmann <r.mark.volkm...@gmail.com>
> wrote:
>>
>> On Thu, Sep 17, 2009 at 9:57 AM, Chouser <chou...@gmail.com> wrote:
>> >
>> > On Thu, Sep 17, 2009 at 12:28 AM, Krukow <karl.kru...@gmail.com> wrote:
>> >>
>> >> Final question. The docs say that 'ensure' permits more concurrency
>> >> than promoting the ref to a write. Is there a quick/simple way of
>> >> explaining how? (Or do I need to go to the source :-)
>> >
>> > If you have multiple transactions ensuring the same var but
>> > no transactions changing it, all those transactions can
>> > proceed simultaneously.  If they all did dummy writes
>> > instead of ensure, they could only proceed in order.
>>
>> Ah ... I think I misunderstood an important part of the question. I
>> wasn't assuming that all the concurrent transactions were going to use
>> ensure or a dummy write on the same Ref. So the key is that multiple
>> transactions can successfully ensure the same Ref, but multiple
>> transactions cannot successfully write the same Ref.
>
> Not with ref-set! or alter!, but maybe with commute identity?

I should have been more clear above. What I meant was that multiple
concurrent transactions cannot write the same Ref without some of them
having to retry. If you use commute instead of ref-set or alter then
they don't have to retry.

-- 
R. Mark Volkmann
Object Computing, Inc.

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