Software / code / prosody
Comparison
util/async.lua @ 5793:e8c79796ead9
util.async: waiter: Throw error if done() called too many times
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Mon, 12 Aug 2013 13:22:27 +0200 |
| parent | 5792:aac4c6147647 |
| child | 5794:66c3ad5d29ad |
comparison
equal
deleted
inserted
replaced
| 5792:aac4c6147647 | 5793:e8c79796ead9 |
|---|---|
| 35 coroutine.yield("wait"); | 35 coroutine.yield("wait"); |
| 36 end, function () | 36 end, function () |
| 37 num = num - 1; | 37 num = num - 1; |
| 38 if num == 0 and waiting then | 38 if num == 0 and waiting then |
| 39 runner_continue(thread); | 39 runner_continue(thread); |
| 40 elseif num < 0 then | |
| 41 error("done() called too many times"); | |
| 40 end | 42 end |
| 41 end; | 43 end; |
| 42 end | 44 end |
| 43 | 45 |
| 44 local runner_mt = {}; | 46 local runner_mt = {}; |