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:6080 top

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

Comments top

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