Yup that's correct.

"Agents are integrated with the STM - any dispatches made in a
transaction are held until it commits, and are discarded if it is
retried or aborted." http://clojure.org/agents

Atoms can't do this, as they are synchronous (called and returned
immediately) - hence the warning about potentially being called
multiple times.


On Oct 8, 12:12 pm, pmf <phil.fr...@gmx.de> wrote:
> IIRC, dispatching to agents (via send or send-off) during a dosync
> only happens if the transaction was successful (this was discussed in
> several places, thoughhttp://clojure.org/refsdoes not mention this;
> maybe this should be included there, if this is really something that
> is guaranteed).
>
> I'd like to know whether the same is true for using swap! on atoms
> (i.e. if send(-off)s are only made when the operation succeeds). The
> reason being that the documentation of swap! mentions that the
> function may be applied more than once if the swap! fails.
--~--~---------~--~----~------------~-------~--~----~
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