FIX: fixed empty bug

This commit is contained in:
Dominik Meyer 2024-01-16 12:41:45 +01:00
parent 0198266526
commit 91ef7ad770
Signed by untrusted user: byterazor
GPG Key ID: EABDA0FD5981BC97
2 changed files with 10 additions and 5 deletions

View File

@ -294,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)
{ {

View File

@ -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")