Or you could just modify the source of promise ... i dont know why promises dont support timeouts ....
(defprotocol PWait (wait-for [this timeout units] [this timeout])) ;;copied from clojure source, but adding timeout wait-for (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." {:added "1.1"} [] (let [d (java.util.concurrent.CountDownLatch. 1) v (atom nil)] (reify clojure.lang.IDeref (deref [_] (.await d) @v) PWait (wait-for [this timeout] (wait-for this timeout java.util.concurrent.TimeUnit/MILLISECONDS)) (wait-for [this timeout units] (if timeout (.await d timeout units) (do (.await d) true))) clojure.lang.IFn (invoke [this x] (locking d (if (pos? (.getCount d)) (do (reset! v x) (.countDown d) x) (throw (IllegalStateException. "Multiple deliver calls to a promise")))))))) -- 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