mirror of
https://github.com/SantaSpeen/BeamMP-Server.git
synced 2026-02-16 15:30:40 +00:00
Lua: Fix threading related crash
This commit is contained in:
@@ -64,9 +64,11 @@ TConsole::TConsole() {
|
||||
auto Future = mLuaEngine->EnqueueScript(mStateId, std::make_shared<std::string>(cmd));
|
||||
// wait for it to finish
|
||||
while (!Future->Ready) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
if (Future->Error) {
|
||||
beammp_error(Future->ErrorMessage);
|
||||
}
|
||||
mCommandline.write("Result ready.");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -82,6 +84,6 @@ void TConsole::WriteRaw(const std::string& str) {
|
||||
}
|
||||
|
||||
void TConsole::InitializeLuaConsole(TLuaEngine& Engine) {
|
||||
Engine.EnsureStateExists(mStateId, "<>");
|
||||
Engine.EnsureStateExists(mStateId, "Console");
|
||||
mLuaEngine = &Engine;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user