Software /
code /
prosody
Diff
util/async.lua @ 8611:937de0c39279
util.async: Add comment
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Mar 2018 22:31:12 +0000 |
parent | 8610:b03c7884fade |
child | 8613:dbb4788db8e3 |
line wrap: on
line diff
--- a/util/async.lua Fri Mar 16 22:30:25 2018 +0000 +++ b/util/async.lua Fri Mar 16 22:31:12 2018 +0000 @@ -21,6 +21,7 @@ -- Running the coroutine failed, which means we have to find the runner manually, -- in order to inform the error handler local level = 0; + -- Find the 'level' of the top-most function (0 == current level, 1 == caller, ...) while debug.getinfo(thread, level, "") do level = level + 1; end ok, runner = debug.getlocal(thread, level-1, 1); assert(ok == "self", "unexpected async state: variable mismatch");