Software /
code /
prosody
Comparison
util/async.lua @ 8601:ce5b16e13573
util.async: Log warning when unexpected state is reached
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Mar 2018 17:11:23 +0000 |
parent | 8600:96f20cf92b84 |
child | 8602:9901deadc068 |
comparison
equal
deleted
inserted
replaced
8600:96f20cf92b84 | 8601:ce5b16e13573 |
---|---|
10 end | 10 end |
11 | 11 |
12 local function runner_continue(thread) | 12 local function runner_continue(thread) |
13 -- ASSUMPTION: runner is in 'waiting' state (but we don't have the runner to know for sure) | 13 -- ASSUMPTION: runner is in 'waiting' state (but we don't have the runner to know for sure) |
14 if coroutine.status(thread) ~= "suspended" then -- This should suffice | 14 if coroutine.status(thread) ~= "suspended" then -- This should suffice |
15 log("warn", "unexpected async state: thread not suspended"); | |
15 return false; | 16 return false; |
16 end | 17 end |
17 local ok, state, runner = coroutine.resume(thread); | 18 local ok, state, runner = coroutine.resume(thread); |
18 if not ok then | 19 if not ok then |
19 -- Running the coroutine failed, which means we have to find the runner manually, | 20 -- Running the coroutine failed, which means we have to find the runner manually, |