Skip to content

Instantly share code, notes, and snippets.

@Raynes Raynes/eval.clj
Created Mar 19, 2010

What would you like to do?
(defn thunk-timeout [thunk]
(let [task (future-call thunk)]
(.get task 1 TimeUnit/SECONDS)
(catch TimeoutException e
(.cancel task true) "Execution timed out!"))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.