main #2

Merged
byterazor merged 3 commits from csander/EventManagementSystem:main into main 2022-08-30 18:16:48 +02:00
2 changed files with 5 additions and 8 deletions
Showing only changes of commit 1ed68d302d - Show all commits

View File

@ -70,7 +70,7 @@
std::mutex mutexSchedulingParticipants_; std::mutex mutexSchedulingParticipants_;
/// list of all participants connected /// list of all participants connected
std::list<std::shared_ptr<EventManager::Participant>> particpants_; std::list<std::shared_ptr<EventManager::Participant>> participants_;
/// mutex to protect participants_ /// mutex to protect participants_
std::mutex mutexParticipants_; std::mutex mutexParticipants_;

View File

@ -352,7 +352,7 @@
{ {
std::shared_ptr<EventManager::Participant> participant = connectionQueue_.front(); std::shared_ptr<EventManager::Participant> participant = connectionQueue_.front();
connectionQueue_.pop(); connectionQueue_.pop();
particpants_.push_back(participant); participants_.push_back(participant);
participant->init(); participant->init();
@ -375,20 +375,17 @@
void EventManager::Manager::disconnect(std::shared_ptr<EventManager::Participant> participant) void EventManager::Manager::disconnect(std::shared_ptr<EventManager::Participant> participant)
{ {
disconnect(participant); disconnect(participant);
std::lock_guard<std::mutex> guard(mutexParticipants_); std::lock_guard<std::mutex> guard(mutexParticipants_);
std::list<std::shared_ptr<EventManager::Participant>>::iterator it; std::list<std::shared_ptr<EventManager::Participant>>::iterator it;
it = std::find(particpants_.begin(), particpants_.end(),participant); it = std::find(participants_.begin(), participants_.end(),participant);
if (it != particpants_.end()) if (it != participants_.end())
{ {
particpants_.erase(it); participants_.erase(it);
} }
participant->setManager(nullptr); participant->setManager(nullptr);
} }