From 2a24619a8a781fc0d65ed11797a32c1bc88a7e3b Mon Sep 17 00:00:00 2001 From: ackimixs Date: Wed, 8 May 2024 14:53:34 +0200 Subject: [PATCH] thread --- TCPServer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/TCPServer.cpp b/TCPServer.cpp index fa16923..f74c1fb 100644 --- a/TCPServer.cpp +++ b/TCPServer.cpp @@ -126,9 +126,11 @@ void TCPServer::handleMessage(const std::string& message, int clientSocket) if (!gameStarted) return; this->stopEmergency = true; - this->gameThread.~thread(); + this->broadcastMessage("strat;arduino;clear;1\n"); + this->gameThread.~thread(); + std::vector args = TCPUtils::split(tokens[3], ","); if (!handleEmergencyFlag) { @@ -794,6 +796,9 @@ void TCPServer::awaitRobotIdle() { usleep(50'000); this->sendToClient("strat;arduino;get state;1\n", this->arduinoSocket); timeout++; + if (stopEmergency) { + std::terminate(); + } if (timeout > 80) { this->broadcastMessage("strat;arduino;clear;1"); break;