Add an assert check to make sure no threads scheduled in nonauth model
This commit is contained in:
@@ -312,7 +312,7 @@ LuaDefine(wait, "nticks",
|
|||||||
return LS.result();
|
return LS.result();
|
||||||
} else {
|
} else {
|
||||||
// in an authoritative model, wait schedules a continuation.
|
// in an authoritative model, wait schedules a continuation.
|
||||||
w->thread_sched_.add(w->clock_ + n, w->lthread_thread_id_, w->lthread_place_id_);
|
w->schedule(w->clock_ + n, w->lthread_thread_id_, w->lthread_place_id_);
|
||||||
lua_yield(L, 0);
|
lua_yield(L, 0);
|
||||||
return LS.result();
|
return LS.result();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.rawset(threads, tid, thinfo);
|
||||||
LS.result();
|
LS.result();
|
||||||
|
|
||||||
thread_sched_.add(0, tid, place_id);
|
schedule(0, tid, place_id);
|
||||||
run_scheduled_threads();
|
run_scheduled_threads();
|
||||||
assert(stack_is_clear());
|
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,
|
// Push the thread's ID into the runnable thread queue,
|
||||||
// then run the thread queue.
|
// then run the thread queue.
|
||||||
thread_sched_.add(0, tid, place_id);
|
schedule(0, tid, place_id);
|
||||||
run_scheduled_threads();
|
run_scheduled_threads();
|
||||||
assert(stack_is_clear());
|
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() {
|
void World::run_scheduled_threads() {
|
||||||
assert(stack_is_clear());
|
assert(stack_is_clear());
|
||||||
lua_State *L = state();
|
lua_State *L = state();
|
||||||
|
|||||||
@@ -264,6 +264,10 @@ public:
|
|||||||
int64_t alloc_id_predictable();
|
int64_t alloc_id_predictable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Add a thread to the scheduler queue.
|
||||||
|
//
|
||||||
|
void schedule(int64_t clk, int64_t thid, int64_t plid);
|
||||||
|
|
||||||
// Store a pointer to a world model into a lua registry.
|
// Store a pointer to a world model into a lua registry.
|
||||||
//
|
//
|
||||||
static void store_global_pointer(lua_State *L, World *w);
|
static void store_global_pointer(lua_State *L, World *w);
|
||||||
|
|||||||
Reference in New Issue
Block a user