David, Agents are designed to be call only once. That's why they're useful for I/O (stuff w/ side effects). refs, however, will retry inside a transactions.
As always, Rich explains it better than me: http://www.infoq.com/presentations/Value-Identity-State-Rich-Hickey Sean On Nov 9, 11:41 pm, David Brown <cloj...@davidb.org> wrote: > On Mon, Nov 09, 2009 at 08:28:43PM -0800, David Brown wrote: > >In both cases, the reads run completely synchronously, waiting for > >their answer, and really the whole thing isn't really any better than > >just using locks. > > I guess a deeper concern is that there seems to only be a single call > in the entire Clojure concurrency system: 'await'. > > One very useful extension GHC adds to STM is the 'retry' call, which > causes the transaction to retry, but it blocks until something else > modifies one of the refs that it has read. It allows any arbitrary > concurrency to be implemented, since now a thread can wait for a > result, for example. > > Should I just be less afraid of using the Java concurrency classes? > > David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---