Software /
code /
prosody
Comparison
util/async.lua @ 8648:ca710a71d730
util.async: Add ready() to check whether running in async context
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 22 Mar 2018 07:46:23 +0000 |
parent | 8629:ddb04cacb8b1 |
child | 8649:9246f64d6f1e |
comparison
equal
deleted
inserted
replaced
8647:638ff2ad98e6 | 8648:ca710a71d730 |
---|---|
213 | 213 |
214 function runner_mt:log(level, fmt, ...) | 214 function runner_mt:log(level, fmt, ...) |
215 return log(level, "[runner %s] "..fmt, self.id, ...); | 215 return log(level, "[runner %s] "..fmt, self.id, ...); |
216 end | 216 end |
217 | 217 |
218 return { waiter = waiter, guarder = guarder, runner = runner }; | 218 local function ready() |
219 return pcall(checkthread); | |
220 end | |
221 | |
222 return { ready = ready, waiter = waiter, guarder = guarder, runner = runner }; |