Software / code / prosody
Comparison
util/async.lua @ 7359:a5a080c12c96
Update every link to the documentation to use HTTPS
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
|---|---|
| date | Sat, 16 Apr 2016 21:08:05 +0100 |
| parent | 5797:a493b79cfad0 |
| child | 7436:649b89b2c840 |
comparison
equal
deleted
inserted
replaced
| 7358:d0390bc9c5d1 | 7359:a5a080c12c96 |
|---|---|
| 23 end | 23 end |
| 24 | 24 |
| 25 local function waiter(num) | 25 local function waiter(num) |
| 26 local thread = coroutine.running(); | 26 local thread = coroutine.running(); |
| 27 if not thread then | 27 if not thread then |
| 28 error("Not running in an async context, see http://prosody.im/doc/developers/async"); | 28 error("Not running in an async context, see https://prosody.im/doc/developers/async"); |
| 29 end | 29 end |
| 30 num = num or 1; | 30 num = num or 1; |
| 31 local waiting; | 31 local waiting; |
| 32 return function () | 32 return function () |
| 33 if num == 0 then return; end -- already done | 33 if num == 0 then return; end -- already done |
| 46 local 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 https://prosody.im/doc/developers/async"); |
| 52 end | 52 end |
| 53 local guard = guards[id]; | 53 local guard = guards[id]; |
| 54 if not guard then | 54 if not guard then |
| 55 guard = {}; | 55 guard = {}; |
| 56 guards[id] = guard; | 56 guards[id] = guard; |