summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Hickey <richhickey@gmail.com>2008-05-01 14:01:24 +0000
committerRich Hickey <richhickey@gmail.com>2008-05-01 14:01:24 +0000
commit3c7cd543d6cffe1add3bc534af5a7a819715f4d0 (patch)
tree2a59a7a96bee9d6c92915b2fc621edaa94021bff
parent81eae9c78fadbcaf455a621022283ffc48689af3 (diff)
throw on await call in agent action
-rw-r--r--src/boot.clj4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/boot.clj b/src/boot.clj
index c023c3a0..a7a346d7 100644
--- a/src/boot.clj
+++ b/src/boot.clj
@@ -1263,6 +1263,8 @@ not-every? (comp not every?))
dispatched thus far, from this thread or agent, to the agent(s) have
occurred."
[& agents]
+ (when *agent*
+ (throw (new Exception "Can't await in agent action")))
(let [latch (new java.util.concurrent.CountDownLatch (count agents))
count-down (fn [agent] (. latch (countDown)) agent)]
(doseq agent agents
@@ -1275,6 +1277,8 @@ not-every? (comp not every?))
timeout (in milliseconds) has elapsed. Returns nil if returning due
to timeout, non-nil otherwise."
[timeout-ms & agents]
+ (when *agent*
+ (throw (new Exception "Can't await in agent action")))
(let [latch (new java.util.concurrent.CountDownLatch (count agents))
count-down (fn [agent] (. latch (countDown)) agent)]
(doseq agent agents