Hi, On Jun 11, 9:18 am, Daniel Janus <nath...@gmail.com> wrote:
> Now, this sometimes works and sometimes doesn't get past the call to > await. Clearly, there's a race condition here: if the computation > happens to bomb out with an error before await is called (case 2 > above), then the 'send' fails to run (which await calls under the > hood): You could roll your own syncronisation. (defn send-off-and-wait [a f & args] (let [latch (java.util.concurrent.CountDownLatch. 1)] (send-off a #(try (apply f % args) (finally (.countDown latch)))) (.await latch))) (send-off-and-wait agent my-computation) (when (agent-errors agent) ; Handle errors... (clear-agent-errors agent)) Not tested, though. Sincerely Meikel -- 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