Hi Laurens,

I am pretty sure (thread ...) only executes once. To check this I evaluated 

(dotimes [i 100] (log "foo")) 

in the REPL and the thread count goes from 23 to 80. On subsequent 
evaluations of (dotimes [i 100] (log "foo")), the count stays at 78. 


Thanks
Nico.


On Monday, October 13, 2014 8:43:51 AM UTC-4, Laurens Van Houtven wrote:
>
> Hi Nico, 
>
>
> Just to rule out the obvious: you’re not recompiling that namespace ever 
> time, right? Because if you call (thread …) a bunch of times, you’re gonna 
> get a bunch of threads :-) 
>
>
> cheers 
> lvh 
>
>
>
> On 13 Oct 2014, at 14:21, Nico Swart <jns...@gmail.com <javascript:>> 
> wrote: 
>
> >  I am experimenting with core.async and I am using some code from a Tim 
> Baldridge presentation: 
> > 
> > ;;;;; Logging Handler ;;;;; 
> > 
> > (def log-chan (chan)) 
> > 
> > (thread 
> >  (loop [] 
> >    (when-let [v (<!! log-chan)] 
> >      (println v) 
> >      (recur))) 
> >  (println "Log Closed")) 
> > 
> > 
> > (close! log-chan) 
> > 
> > (defn log [msg] 
> >   (>!! log-chan msg)) 
> > 
> > (log "foo") 
> > 
> > If one executes (log "foo") a number of times the thread count of the 
> process increases every time this function is called. My expectation 
> > was that only one extra thread will be created in this code. Watching 
> the number of threads in Windows task manager, the threads of the process 
> > was 28, but after calling this function a number of times, the count was 
> up to 93. Is this expected behaviour ? 
> > 
> > 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Clojure" group. 
> > To post to this group, send email to clo...@googlegroups.com 
> <javascript:> 
> > Note that posts from new members are moderated - please be patient with 
> your first post. 
> > To unsubscribe from this group, send email to 
> > clojure+u...@googlegroups.com <javascript:> 
> > For more options, visit this group at 
> > http://groups.google.com/group/clojure?hl=en 
> > --- 
> > You received this message because you are subscribed to the Google 
> Groups "Clojure" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to clojure+u...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to