You're viewing version 1.2.0 of future-cancel. The latest stable version of Clojure Core is 1.3.0.
1.2.0 Arrow_down_16x16

future-cancel

clojure.core

  • (future-cancel f)
Cancels the future, if possible.

2 Examples top

  • user=> (def f (future (Thread/sleep 5000) (inc 0)))
    #'user/f
    
    user=> (future-cancel f)                           
    true
    
    user=> (future-cancelled? f)                       
    true
  • user=> (def f (future (inc 0)))
    #'user/f
    
    user=> (future-cancel f)                           
    false
    
    user=> (future-cancelled? f)                       
    false
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:5416 top

(defn future-cancel
  "Cancels the future, if possible."
  {:added "1.1"}
  [^java.util.concurrent.Future f] (.cancel f true))
Vars in clojure.core/future-cancel: defn
Used in 0 other vars

Comments top

No comments for future-cancel. Log in to add a comment.