Compare commits
3 Commits
caa13b0159
...
91ef7ad770
Author | SHA1 | Date |
---|---|---|
Dominik Meyer | 91ef7ad770 | |
Dominik Meyer | 0198266526 | |
Dominik Meyer | 22ff983817 |
|
@ -42,7 +42,7 @@
|
||||||
std::uint64_t responseId_;
|
std::uint64_t responseId_;
|
||||||
|
|
||||||
/// identifies if this event is a response to another event
|
/// identifies if this event is a response to another event
|
||||||
std::atomic<bool> isResponse_;
|
bool isResponse_;
|
||||||
|
|
||||||
/// emitter of the event
|
/// emitter of the event
|
||||||
std::shared_ptr<EventManager::Participant> emitter_;
|
std::shared_ptr<EventManager::Participant> emitter_;
|
||||||
|
|
|
@ -88,7 +88,10 @@
|
||||||
throw std::runtime_error("can not stop main thread");
|
throw std::runtime_error("can not stop main thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
mainThread_->join();
|
if (mainThread_->joinable())
|
||||||
|
{
|
||||||
|
mainThread_->join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventManager::Manager::stopScheduling_()
|
void EventManager::Manager::stopScheduling_()
|
||||||
|
@ -107,8 +110,11 @@
|
||||||
throw std::runtime_error("can not stop scheduling thread");
|
throw std::runtime_error("can not stop scheduling thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
schedulingThread_->join();
|
if (schedulingThread_->joinable())
|
||||||
}
|
{
|
||||||
|
schedulingThread_->join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EventManager::Manager::start()
|
void EventManager::Manager::start()
|
||||||
{
|
{
|
||||||
|
@ -288,6 +294,11 @@
|
||||||
bool EventManager::Manager::empty() const
|
bool EventManager::Manager::empty() const
|
||||||
{
|
{
|
||||||
bool isEmpty=true;
|
bool isEmpty=true;
|
||||||
|
|
||||||
|
while(!commandQueue_.empty())
|
||||||
|
{
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
}
|
||||||
|
|
||||||
for (auto it = eventMap_.begin(); it != eventMap_.end(); ++it)
|
for (auto it = eventMap_.begin(); it != eventMap_.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,11 @@ SCENARIO("Basic Usage of EventManager", "[Manager]")
|
||||||
manager = std::make_shared<EventManager::Manager>();
|
manager = std::make_shared<EventManager::Manager>();
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
REQUIRE_NOTHROW([&]()
|
||||||
|
{
|
||||||
|
manager->start();
|
||||||
|
}());
|
||||||
|
|
||||||
REQUIRE(manager->empty() == true);
|
REQUIRE(manager->empty() == true);
|
||||||
|
|
||||||
std::shared_ptr<myParticipant> participant0;
|
std::shared_ptr<myParticipant> participant0;
|
||||||
|
@ -107,11 +112,6 @@ SCENARIO("Basic Usage of EventManager", "[Manager]")
|
||||||
|
|
||||||
REQUIRE(manager->empty() == false);
|
REQUIRE(manager->empty() == false);
|
||||||
|
|
||||||
REQUIRE_NOTHROW([&]()
|
|
||||||
{
|
|
||||||
manager->start();
|
|
||||||
}());
|
|
||||||
|
|
||||||
REQUIRE(manager->isRunning() == true);
|
REQUIRE(manager->isRunning() == true);
|
||||||
|
|
||||||
WHEN("emitting shutdown event")
|
WHEN("emitting shutdown event")
|
||||||
|
|
Loading…
Reference in New Issue