From 64ff027e645208c1a64a6dbeb2d1540da9e718f8 Mon Sep 17 00:00:00 2001 From: Niels Breuker Date: Sun, 2 Oct 2022 12:54:47 +0200 Subject: First PoC for multithreading in plugins. Crashes on reload while another thread is active. No nice way to return to the default lua_State --- src/Bindings/LuaState.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Bindings/LuaState.cpp') diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index e4c537967..a6ba3397c 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -1033,6 +1033,16 @@ void cLuaState::Push(cLuaTCPLink * a_TCPLink) +void cLuaState::Push(std::thread* a_Thread) { + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Thread, "std::thread *"); +} + + + + + void cLuaState::Push(cLuaUDPEndpoint * a_UDPEndpoint) { ASSERT(IsValid()); @@ -1099,6 +1109,17 @@ void cLuaState::Push(std::chrono::milliseconds a_Value) + +void cLuaState::Push(std::mutex * a_Mutex) { + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Mutex, "std::mutex *"); +} + + + + + void cLuaState::Pop(int a_NumValuesToPop) { ASSERT(IsValid()); -- cgit v1.2.3