Skip to content

Instantly share code, notes, and snippets.

@loganmhb
Created Feb 21, 2017
Embed
What would you like to do?
fun pathological atom situation
(def a (atom 0))
(def f1 (future
(while (< @a 1000000000)
(swap! a inc))
(println "Done incrementing!")))
(def f2 (future
(swap! a (fn [current-val]
(println "Trying...`a' is" current-val)
(Thread/sleep 10) ; actually usually works without this, just from the delay println introduces
0))
(println "Successfully reset!")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment