On Thu, Jan 21, 2010 at 11:35 PM, tsuraan <tsur...@gmail.com> wrote:
> What is the clojure idiom for running multiple (in this case IO bound)
> functions simultaneously?  My use case is the parallel activities are
> coordinated, basically running in lockstep.  I've been using (.start
> (Thread. myfn)).  It works, but I'm wondering if there's a better way.
>  The data shared between the threads is stored in an agent, which sort
> of suggests send-off to me, but I can't find any reason to think that
> send-off runs everything in parallel.  Any thoughts would be welcome.

When you send-off an action to an agent, that agent gets is
allocated a thread for at least the duration of that action.  So
using send-off on long-running actions to two agents will result
in those actions being run in parallel.

Another option to consider is 'future', new in Clojure 1.1

And finally, there's really nothing wrong with using (.start
(Thread. myfn)), if that accomplishes exactly what you need.

--Chouser
http://joyofclojure.com/

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