Software /
code /
prosody
Comparison
util/async.lua @ 8616:a15c891c6232
util.async: ensure change in e77b37de482e applies after out-of-loop resume also
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 17 Mar 2018 17:28:07 +0000 |
parent | 8615:e77b37de482e |
child | 8625:08bf4df6fdb7 |
comparison
equal
deleted
inserted
replaced
8615:e77b37de482e | 8616:a15c891c6232 |
---|---|
30 end | 30 end |
31 local error_handler = runner.watchers.error; | 31 local error_handler = runner.watchers.error; |
32 if error_handler then error_handler(runner, debug.traceback(thread, err)); end | 32 if error_handler then error_handler(runner, debug.traceback(thread, err)); end |
33 local ready_handler = runner.watchers.ready; | 33 local ready_handler = runner.watchers.ready; |
34 runner.state, runner.thread = "ready", nil; | 34 runner.state, runner.thread = "ready", nil; |
35 if ready_handler then ready_handler(runner); end | 35 return runner:run(); |
36 runner.notified_state = "ready"; | |
37 elseif state == "ready" then | 36 elseif state == "ready" then |
38 -- If state is 'ready', it is our responsibility to update runner.state from 'waiting'. | 37 -- If state is 'ready', it is our responsibility to update runner.state from 'waiting'. |
39 -- We also have to :run(), because the queue might have further items that will not be | 38 -- We also have to :run(), because the queue might have further items that will not be |
40 -- processed otherwise. FIXME: It's probably best to do this in a nexttick (0 timer). | 39 -- processed otherwise. FIXME: It's probably best to do this in a nexttick (0 timer). |
41 runner.state = "ready"; | 40 runner.state = "ready"; |