I've added some discussion about this behavior in an example for 
clojure.core/future on ClojureDocs.org here:

http://clojuredocs.org/clojure_core/clojure.core/future

Since people often come across this behavior when using pmap or 
clojure.java.shell/sh, which are implemented using Clojure futures, I've added 
examples to those two functions that recommend reading the examples for future.

Andy

On May 8, 2012, at 11:18 AM, Andy Fingerhut wrote:

> Not desired, but currently normal behavior.
> 
> This happens whenever certain concurrency features of Clojure are used, 
> creating other threads, and they take a while for them to be cleaned up on 
> exit.  Besides pmap, futures and a few other Clojure functions cause this.  
> You can work around it if you call (shutdown-agents) before the end of your 
> program.
> 
> http://dev.clojure.org/jira/browse/CLJ-124
> 
> Andy
> 
> 
> On May 7, 2012, at 3:16 PM, Muharem Hrnjadovic wrote:
> 
>> Hello there!
>> 
>> I only started learning Clojure today, so please forgive me if this is
>> a stupid question or something..
>> 
>> I am experimenting with Clojure's pmap operator as shown in the source
>> here:
>>   
>> https://github.com/freizeit/exercises/blob/master/cj-a-store-credit/clojure/ex1.clj
>> 
>> With line 14 (the exit() call) in place the program takes a second to
>> run:
>> 
>>   $ time clojure -m ex1 /etc/motd
>>   #<LinkedBlockingQueue [110, 60]> /etc/motd
>> 
>>   real       0m1.013s
>>   user       0m1.284s
>>   sys        0m0.032s
>> 
>> With line 14 commented out or removed the program prints this part
>> immediately:
>> 
>>   $ time clojure -m ex1 /etc/motd
>>   #<LinkedBlockingQueue [110, 60]> /etc/motd
>> 
>> *but* the rest comes a minute later:
>> 
>>   real       1m0.997s
>>   user       0m1.336s
>>   sys        0m0.080s
>> 
>> Is this normal/desired behaviour? If not, can somebody please explain
>> why this is happening? Thanks!
>> 
>> FWIW, I am observing this with Clojure 1.3.0 on debian (LMDE [1]).
>> 
>> [1] http://www.linuxmint.com/download_lmde.php
>> 
>> Best regards/Mit freundlichen Grüßen
>> 
>> -- 
>> Muharem Hrnjadovic <m...@foldr3.com>
>> Public key id   : B2BBFCFC
>> Key fingerprint : A5A3 CC67 2B87 D641 103F  5602 219F 6B60 B2BB FCFC
>> 
> 

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