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
commit0e702abb1f191bbf83bf3b24a99536fa4dc3dd73 (patch)
tree6cf0994c6b3b56a8aa23b3e067ea59e28776fe5b
parent516179867e7ffbe56343375aa0d8abcf41dee83a (diff)
downloadprosody-0e702abb1f191bbf83bf3b24a99536fa4dc3dd73.tar.gz
prosody-0e702abb1f191bbf83bf3b24a99536fa4dc3dd73.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