1.3.0 permalink Arrow_down_16x16

future-done?

clojure.core

  • (future-done? f)
Returns true if future f is done

2 Examples top

  • user=> (def f (future (Thread/sleep 5000) (inc 0)))
    
    user=> (future-done? f)                            
    false
    
    user=> (Thread/sleep 5000)
    nil
    
    user=> (future-done? f)
    true
    
    
  • ;; beware of cancellation !!!
    
    user=> (def f (future (Thread/sleep 5000) (inc 0)))
    #'user/f
    
    user=> (future-cancel f)                           
    true
    
    user=> (future-cancelled? f)                       
    true
    
    user=> (future-done? f)                            
    true
    
    user=> @f                                          
    java.util.concurrent.CancellationException (NO_SOURCE_FILE:0)
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:5744 top

(defn future-done?
  "Returns true if future f is done"
  {:added "1.1"
   :static true}
  [^java.util.concurrent.Future f] (.isDone f))
Vars in clojure.core/future-done?:
Used in 0 other vars

Comments top

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