You need to remember to ...

clojure.core/shutdown-agents
([])
  Initiates a shutdown of the thread pools that back the agent
  system. Running actions will complete, but no new actions will be
  accepted
nil


On Tue, Jan 6, 2009 at 3:35 AM, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:
>
> Why doesn't the following code terminate on its own? It outputs the
> number 6 as expected, but then just hangs. I'm guessing its related to
> non-daemon threads related to agents that are still running. What's
> the proper way to exit?
>
> (def my-agent (agent 1))
>
> (defn sleep-and-multiply [old-state times ms]
>  (Thread/sleep ms)
>  (* old-state times))
>
> (send-off my-agent sleep-and-multiply 2 1500)
> (send-off my-agent sleep-and-multiply 3 1000)
> (await my-agent)
> (println "my-agent =" @my-agent)
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> >
>



-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.

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