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 <jns1...@gmail.com> 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 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.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to