store/[org.clojure/clojure "1.8.0"] clj::clojure.core/future-cancel

Official Documentation

Add notes
Arities
==================================================
   [f]

Docstring
==================================================
  Cancels the future, if possible.

Source

(defn future-cancel
  "Cancels the future, if possible."
  {:added "1.1"
   :static true}
  [^java.util.concurrent.Future f] (.cancel f true))

Example 1

Edit
(def f (future (inc 0)))
;; => #'user/f

(future-cancel f)                           
;; => false

(future-cancelled? f)                       
;; => false

Example 2

Edit
(def f (future (Thread/sleep 5000) (inc 0)))
;; => #'user/f

(future-cancel f)                           
;; => true

(future-cancelled? f)                       
;; => true

Uses on crossclj