From 9287f0084193c1f5641bff222c39c102bdeac39f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:00:07 +0200 Subject: [PATCH] Fixed performance bug in standalone netconsole When unconnected, the frame loop would run as fast as it could. Moved thread sleeper at the bottom in the outer scope of the function to prevent this behavior in all cases. --- r5dev/netconsole/netconsole.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/r5dev/netconsole/netconsole.cpp b/r5dev/netconsole/netconsole.cpp index b968e851..e58cb382 100644 --- a/r5dev/netconsole/netconsole.cpp +++ b/r5dev/netconsole/netconsole.cpp @@ -200,9 +200,7 @@ void CNetCon::RunFrame(void) { if (m_bConnEstablished) { - std::this_thread::sleep_for(std::chrono::milliseconds(50)); std::lock_guard l(m_Mutex); - this->Recv(); } else if (m_bPromptConnect) @@ -210,6 +208,7 @@ void CNetCon::RunFrame(void) DevMsg(eDLL_T::NONE, "Enter []: or : "); m_bPromptConnect = false; } + std::this_thread::sleep_for(std::chrono::milliseconds(50)); } //-----------------------------------------------------------------------------