Not currently. I added the capability to some code I posted last month for fixing print-method for promises so they aren't auto-dereferenced when undelivered:
(defn promise? [p] (isa? (type p) ::Promise)) (defn promise-delivered? [p] (zero? (.getCount (:d p)))) (defmethod print-method ::Promise [writer p] ((get-method print-method clojure.lang.IDeref) writer p)) (defn promise "Alpha - subject to change. Returns a promise object that can be read with deref/@, and set, once only, with deliver. Calls to deref/@ prior to delivery will block. All subsequent derefs will return the same delivered value without blocking." [] (Promise (java.util.concurrent.CountDownLatch. 1) (atom nil))) But there are good reasons for why you might want to discourage this kind of checking in user code. When each promise can only be written by a single writer (i.e. there is not a race among several potential writers to first deliver the promise) then the input-output behavior of readers is deterministic only if such checking is disallowed. Under such conditions it doesn't matter if the readers try to dereference the promise before or after it is ultimately delivered by the writer. If readers can check the status of the promise, then you can get races between readers and the writer. -Per On Sat, Apr 17, 2010 at 7:00 PM, alux <alu...@googlemail.com> wrote: > Hi, > > is there any nonblocking way I kind find out whether a promise has > been delivered? > > Thanky you, alux > > -- > 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 -- 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