Skip to content

Instantly share code, notes, and snippets.

@amitrathore
Created August 16, 2013 19:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amitrathore/6252899 to your computer and use it in GitHub Desktop.
Save amitrathore/6252899 to your computer and use it in GitHub Desktop.
user> (require '[zolo.utils.thread :as zthread])
nil
user> (def x (atom 0))
#'user/x
user> (defn print-x []
(if (> (swap! x inc) 10)
(throw (RuntimeException. "OUCH!")))
(println @x "Hehe!"))
#'user/print-x
user> (zthread/run-thunk-periodically "TesterFn" print-x 500)
#<ScheduledFutureTask java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@66f42d3>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment