Skip to content

Instantly share code, notes, and snippets.

@mjul
Created May 15, 2011 18:51
Show Gist options
  • Select an option

  • Save mjul/973425 to your computer and use it in GitHub Desktop.

Select an option

Save mjul/973425 to your computer and use it in GitHub Desktop.
with-timeout macro
(defmacro with-timeout [ms & body]
`(let [f# (future ~@body)]
(.get #^java.util.concurrent.Future f# ~ms
java.util.concurrent.TimeUnit/MILLISECONDS)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment