When I run the following code it basically works how I intend it to, except that it hangs after the future is finished. What am I missing - some kind of "close agents/threads" call? How should I do this?
(def name-to-greet (promise))
(future
(println "Hello," @name-to-greet))
(print "What is your name? ")
(flush)
(deliver name-to-greet (read-line))
Futures use the agent thread pool, which uses non-daemon threads, which means Clojure won't shut down till you call (shutdown-agents). imho, this is bogus (see my comments here) and I've made suggestions that Rich said he would consider post-1.2 around this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With