Mercurial > prosody-hg
comparison util/async.lua @ 5797:a493b79cfad0
util.async: Make guarder() local
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 13 Aug 2013 23:38:50 +0100 |
| parents | 0b66cb959161 |
| children | a5a080c12c96 |
comparison
equal
deleted
inserted
replaced
| 5796:0b66cb959161 | 5797:a493b79cfad0 |
|---|---|
| 41 error("done() called too many times"); | 41 error("done() called too many times"); |
| 42 end | 42 end |
| 43 end; | 43 end; |
| 44 end | 44 end |
| 45 | 45 |
| 46 function guarder() | 46 local function guarder() |
| 47 local guards = {}; | 47 local guards = {}; |
| 48 return function (id, func) | 48 return function (id, func) |
| 49 local thread = coroutine.running(); | 49 local thread = coroutine.running(); |
| 50 if not thread then | 50 if not thread then |
| 51 error("Not running in an async context, see http://prosody.im/doc/developers/async"); | 51 error("Not running in an async context, see http://prosody.im/doc/developers/async"); |
