Clojure com macros de tempo limite
(ns timeout (:import [java.util.concurrent TimeoutException]))(defmacro with-timeout [msec & body] `(let [f# (future (do ~@body)) v# (gensym) result# (deref f# ~msec v#)] (if (= v# result#) (do (future-cancel f#) (throw (TimeoutException.))) …
Continuar lendo