mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-03 14:26:09 +00:00
implement thread names in debug mode
This commit is contained in:
@@ -44,6 +44,7 @@ void ClearStack(lua_State* L) {
|
||||
}
|
||||
|
||||
std::any Trigger(TLuaFile* lua, const std::string& R, std::shared_ptr<TLuaArg> arg) {
|
||||
RegisterThread(lua->GetFileName());
|
||||
std::lock_guard<std::mutex> lockGuard(lua->Lock);
|
||||
std::packaged_task<std::any(std::shared_ptr<TLuaArg>)> task([lua, R](std::shared_ptr<TLuaArg> arg) { return CallFunction(lua, R, arg); });
|
||||
std::future<std::any> f1 = task.get_future();
|
||||
@@ -180,7 +181,7 @@ void ExecuteAsync(TLuaFile* lua, const std::string& FuncName) {
|
||||
}
|
||||
|
||||
void CallAsync(TLuaFile* lua, const std::string& Func, int U) {
|
||||
//DebugPrintTID();
|
||||
RegisterThread(lua->GetFileName());
|
||||
lua->SetStopThread(false);
|
||||
int D = 1000 / U;
|
||||
while (!lua->GetStopThread()) {
|
||||
@@ -623,6 +624,7 @@ std::string TLuaFile::GetOrigin() {
|
||||
}
|
||||
|
||||
std::any CallFunction(TLuaFile* lua, const std::string& FuncName, std::shared_ptr<TLuaArg> Arg) {
|
||||
RegisterThread(lua->GetFileName());
|
||||
lua_State* luaState = lua->GetState();
|
||||
lua_getglobal(luaState, FuncName.c_str());
|
||||
if (lua_isfunction(luaState, -1)) {
|
||||
|
||||
Reference in New Issue
Block a user