ClojureDocs

Nav

Namespaces

future-call

clojure.core

Available since 1.1 (source)
  • (future-call f)
Takes a function of no args and yields a future object that will
invoke the function in another thread, and will cache the result and
return it on all subsequent calls to deref/@. If the computation has
not yet finished, calls to deref/@ will block, unless the variant
of deref with timeout is used. See also - realized?.
1 Example
;; future-call is used to implement 'future'.  See examples for 'future'
;; for discussion of an undesirable 1-minute wait that can occur before
;; your standalone Clojure program exits if you do not use shutdown-agents.
See Also

Takes a body of expressions and yields a future object that will invoke the body in another thread...

Added by ninjudd
1 Note
    By , created 7.0 years ago

    future-call will also preserve the calling thread's dynamic bindings in the thread that executes f.