use jthread to join thread on scope exit

This commit is contained in:
Lion Kortlepel
2026-04-07 20:25:17 +00:00
parent d56d9892c4
commit 8cdee376c6
+1 -4
View File
@@ -718,7 +718,7 @@ void TNetwork::TCPClient(const std::weak_ptr<TClient>& c) {
OnConnect(c);
RegisterThread("(" + std::to_string(c.lock()->GetID()) + ") \"" + c.lock()->GetName() + "\"");
std::thread QueueSync(&TNetwork::Looper, this, c);
std::jthread QueueSync(&TNetwork::Looper, this, c);
while (true) {
if (c.expired())
@@ -744,9 +744,6 @@ void TNetwork::TCPClient(const std::weak_ptr<TClient>& c) {
}
}
if (QueueSync.joinable())
QueueSync.join();
if (!c.expired()) {
auto Client = c.lock();
OnDisconnect(c);