2011/1/27 Ken Wesson <kwess...@gmail.com>:
> On Thu, Jan 27, 2011 at 2:09 PM, Michael Gardner <gardne...@gmail.com> wrote:
>> On Jan 27, 2011, at 7:24 AM, Rasmus Svensson wrote:
>>
>>> If you simply want all tasks to be performed as quickly as possible,
>>> one alternative could be to use an ExecutorService (perhaps one
>>> created with newFixedThreadPool) with its invokeAll method. invokeAll
>>> takes a collection of callables (in clojure terms: you can pass it a
>>> seq of zero-arg functions) and returns a collection of futures. An
>>> ExecutorService could perhaps give you fine-grained control.
>>>
>>> I recently wrote a blog post on this; you might find it interesting:
>>> http://blog.raek.se/2011/01/24/executors-in-clojure/
>>
>> Thanks for the tip. By coincidence, I just stumbled across ExecutorService 
>> yesterday via the example at http://clojure.org/concurrent_programming. I'm 
>> never thrilled about having to use Java APIs directly, but in this case an 
>> ExecutorService does what I want much better than pmap, and isn't too 
>> difficult to use.
>
> Perhaps pmap should be rewritten to use ExecutorService, if that is so.

Actually, 'pmap' is built on top of 'future' which is built on top of
an ExecutorService.

// raek

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