On Thu, Nov 26, 2009 at 8:05 AM, Robert Campbell <rrc...@gmail.com> wrote:
> If you have this: > > user> (def f (future (Thread/sleep 20000) :done)) > #'user/f > user> @f ; this immediate deref blocks for 20 sec, finally returning > :block > :done > user> @f ; returns immediately > :done > > What is actually happening when you call the first @f? You are waiting > for the function to finish executing and return a value? Or are you > waiting for a return value to appear in the ref slot? > > Is there any way to check if there is a value ready or if the function > has returned w/out blocking? > future-done? user=> (def f (future (Thread/sleep 20000) :done)) #'user/f user=> (future-done? f) false user=> @f :done user=> (future-done? f) true Christophe -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en