aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2013-08-12 13:22:27 +0200
committerKim Alvefur <zash@zash.se>2013-08-12 13:22:27 +0200
commitdc95267cdbe95e15092470d15ead892b80302167 (patch)
tree6cf0994c6b3b56a8aa23b3e067ea59e28776fe5b
parent86a6492eb08c6990824d23d90a5675c8b3c76695 (diff)
downloadprosody-dc95267cdbe95e15092470d15ead892b80302167.tar.gz
prosody-dc95267cdbe95e15092470d15ead892b80302167.zip
util.async: waiter: Throw error if done() called too many times
-rw-r--r--util/async.lua2
1 files changed, 2 insertions, 0 deletions
diff --git a/util/async.lua b/util/async.lua
index c81f8639..d0bc6c3d 100644
--- a/util/async.lua
+++ b/util/async.lua
@@ -37,6 +37,8 @@ local function waiter(num)
num = num - 1;
if num == 0 and waiting then
runner_continue(thread);
+ elseif num < 0 then
+ error("done() called too many times");
end
end;
end