clojure.core/await¶
Blocks the current thread (indefinitely!) until all actions dispatched thus far, from this thread or agent, to the agent(s) have occurred. Will block on failed agents. Will never return if a failed agent is restarted with :clear-actions true or shutdown-agents was called.
Examples¶
Note by andrewni420¶
;;It is not actually allowed to await on an action dispatched from an agent to an agent
(def m (agent 0))
(def n (agent 0))
(defn step
[agent1 agent2]
(try (await (send agent2 inc))
(catch Exception e (println e)))
agent1)
;;Evaluating this throws an error saying "Can't await in agent action"
(send m #(step % n))
See also¶
Content from the matching ClojureDocs page, with authors credited on each contribution.