FIX: fixed issue of deleting entity

This commit is contained in:
Henry Winkel
2023-12-19 19:47:20 +01:00
parent 549072fd80
commit 3b4d4baa1b
2 changed files with 19 additions and 10 deletions

View File

@@ -138,32 +138,41 @@ namespace Entities
void Entity::stop() void Entity::stop()
{ {
stopChild(); try {
PodController_->stopAllPods(); PodController_->stopAllPods();
LOG_S(INFO)<<"Pods stoppt";
MovemtServer_.reset(); stopChild();
LOG_S(INFO)<<"childs stoppt";
// MovemtServer_.reset();
LOG_S(INFO)<<"MovemtServer_ reseted";
stopMainLoop = true; stopMainLoop = true;
BroadcastServer_.reset(); // BroadcastServer_.reset();
LOG_S(INFO)<<"BroadcastServer_ reseted";
for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();) for (std::vector<std::thread>::iterator it = threads.begin(); it != threads.end();)
{ {
if (it->joinable()) if (it->joinable())
{ {
it->join(); it->join();
it = threads.erase(it); it = threads.erase(it);
} }
} }
LOG_S(ERROR)<< threads.size(); LOG_S(ERROR)<< "Remaining Threads: " << threads.size();
std::this_thread::sleep_for(std::chrono::milliseconds(30000)); // std::this_thread::sleep_for(std::chrono::milliseconds(30000));
exit(0); // exit(0);
} catch (const std::exception e) {
LOG_S(ERROR)<< e.what();
}
} }
void Entity::startMovementWorker() void Entity::startMovementWorker()