Overhaul of thread handling to support blocking functions other than wait

This commit is contained in:
2022-04-25 17:17:41 -04:00
parent bd389c7815
commit 9aec7c5299
15 changed files with 144 additions and 88 deletions

View File

@@ -45,14 +45,15 @@ LuaDefine(global_table, "globalname", "get a table where global data can be stor
LuaRet globaltab;
LuaVar globaldb;
LuaStack LS(L, globalname, globaltab, globaldb);
LS.checkstring(globalname);
// Get a pointer to the globaldb.
LS.rawget(globaldb, LuaRegistry, "globaldb");
if (!LS.istable(globaldb)) {
return lua_yield(L, 0); // donotpredict
}
LS.checkstring(globalname);
// nopredict
if (lua_isyieldable(L) && (!LS.istable(globaldb))) {
return lua_yield(L, 0);
}
// Get the globaltab from the globaldb, sanity check it.
LS.rawget(globaltab, globaldb, globalname);