Lots of work on debugging diff xmit
This commit is contained in:
@@ -586,11 +586,13 @@ void World::run_scheduled_threads(int64_t clk) {
|
||||
|
||||
// Three possible outcomes: finished, yielded, or errored.
|
||||
if (status == LUA_YIELD) {
|
||||
// When the wait statement yields, it yields the desired timestamp.
|
||||
if ((lua_gettop(CO) != 1) || (!lua_isnumber(CO, 1))) {
|
||||
std::cerr << "Thread yielded incorrectly. Killing it." << std::endl;
|
||||
// If there's nothing on the stack, infer that tangible.nopredict yielded.
|
||||
if (lua_gettop(CO) == 0) {
|
||||
std::cerr << "Thread killed self using tangible.nopredict" << std::endl;
|
||||
LS.rawset(threads, sched.thread_id(), LuaNil);
|
||||
} else {
|
||||
}
|
||||
// If there's a single number on the stack, infer that 'wait' yielded.
|
||||
else if ((lua_gettop(CO) == 1) && (lua_isnumber(CO, 1))) {
|
||||
lua_Number delay = lua_tonumber(CO, 1);
|
||||
lua_settop(CO, 0);
|
||||
LS.rawset(thinfo, "isnew", false);
|
||||
@@ -599,6 +601,11 @@ void World::run_scheduled_threads(int64_t clk) {
|
||||
thread_sched_.add(sched.clock() + int64_t(delay), sched.thread_id(), sched.place_id());
|
||||
std::cerr << "Added to schedule." << std::endl;
|
||||
}
|
||||
// In any other case, generate an error and kill the coroutine.
|
||||
else {
|
||||
std::cerr << "Thread yielded incorrectly. Killing it." << std::endl;
|
||||
LS.rawset(threads, sched.thread_id(), LuaNil);
|
||||
}
|
||||
} else if (status == LUA_OK) {
|
||||
// Successfully ran to completion. Remove from thread table.
|
||||
std::cerr << "Thread ran to completion." << std::endl;
|
||||
|
||||
Reference in New Issue
Block a user