From c2a609c913bac2b88ecf131299cb9f08818727be Mon Sep 17 00:00:00 2001 From: Dominik Meyer Date: Sat, 19 Feb 2022 12:32:25 +0100 Subject: [PATCH] ADD: support disable scheduling by manager --- include/EventManager/Participant.hpp | 5 +++++ src/EventManager/Participant.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/include/EventManager/Participant.hpp b/include/EventManager/Participant.hpp index 1d7c5a7..bcd58bb 100644 --- a/include/EventManager/Participant.hpp +++ b/include/EventManager/Participant.hpp @@ -139,6 +139,11 @@ */ void _enableScheduling(); + /** + * @brief disable scheduling of this particpant through the EventManager::Manager + */ + void _disableScheduling(); + /** * @brief check if the participant is scheduled by event manager */ diff --git a/src/EventManager/Participant.cpp b/src/EventManager/Participant.cpp index 5d9f95f..8e2d906 100644 --- a/src/EventManager/Participant.cpp +++ b/src/EventManager/Participant.cpp @@ -118,6 +118,14 @@ void EventManager::Participant::_enableScheduling() isScheduledByManager_=true; } +void EventManager::Participant::_disableScheduling() { + if (manager_ == nullptr) { + throw std::runtime_error("no event manager set yet"); + } + manager_->unschedule(shared_from_this()); + isScheduledByManager_ = false; +} + void EventManager::Participant::_subscribe(std::uint32_t type) { if (manager_ == nullptr)