Changes for clojure.core/shutdown-agents

taylor.sando on Sun, 07 Oct 2012
;; Create the agent that we will be using
user=> (def a (agent 0))

;; Dereference the agent to show the value is 0
user=> @a

;; Create a function that can increment the agent
;; This will continually update the value of the agent
user=> (defn agent-inc [a]
        (send-off *agent* agent-inc)
        (inc a))

;; Send the agent to the agent-inc function
;; The value is 188 because by the time the repl has sent off the
;; agent to the function, the function has already been called recursively
user=> (send a agent-inc)
#<Agent@6b850d: 188>

;; Dereference of the value a second or so later
user=> @a

;; Another dereference in another couple of seconds
user=> @a

;; Shutdown the threads for the agents
user=> (shutdown-agents)

;; Dereference the agent to see what value it is
user=> @a

;; Dereference the agent again in a few seconds
;; It's the same value, because the agent pool of threads are no longer
;; active
user=> @a