Thursday, 9 March 2017

Cancel future With Interrupt Check in Clojure

A snippet for future-cancel with interrupt check. Call this instead of calling future directly.
(defmacro int-future
  [& body]
  `(future (when (not (Thread/interrupted)) ~@body)))