Add an assert check to make sure no threads scheduled in nonauth model

This commit is contained in:
2022-04-27 16:05:45 -04:00
parent 214734b627
commit d28c588468
3 changed files with 12 additions and 3 deletions

View File

@@ -512,7 +512,7 @@ void World::invoke_lua(int64_t actor_id, int64_t place_id, const eng::string &ac
LS.rawset(threads, tid, thinfo);
LS.result();
thread_sched_.add(0, tid, place_id);
schedule(0, tid, place_id);
run_scheduled_threads();
assert(stack_is_clear());
}
@@ -607,7 +607,7 @@ void World::invoke_plan(int64_t actor_id, int64_t place_id, const eng::string &a
// Push the thread's ID into the runnable thread queue,
// then run the thread queue.
thread_sched_.add(0, tid, place_id);
schedule(0, tid, place_id);
run_scheduled_threads();
assert(stack_is_clear());
}
@@ -635,6 +635,11 @@ void World::invoke_lua_source(int64_t actor_id, int64_t place_id, const eng::str
}
}
void World::schedule(int64_t clk, int64_t thid, int64_t plid) {
assert(is_authoritative());
thread_sched_.add(clk, thid, plid);
}
void World::run_scheduled_threads() {
assert(stack_is_clear());
lua_State *L = state();