title: Idiomatic Clojure way to spawn and manage background threads
body: <p>What is the idiomatic Clojure way to create a thread that loops in the background doing updates to some shared refs and to manage its lifetime?  I find myself using <code>future</code> for this, but it feels like a little bit of a hack as I never return a meaningful value.  E.g.:</p>
  
  <pre><code>(future (loop [] (do
      (Thread/sleep 100)
      (dosync (...))
      (recur))))
  </code></pre>
  
  <p>Also, I need to be careful to <code>future-cancel</code> this when the background processing is no longer needed.  Any tips on how to orchestrate that in a Clojure/Swing application would be nice.  E.g. a dummy <code>JComponent</code> that is added to my UI that is responsible for killing the thread when the window is closed may be an idea.</p>