Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

5 changed files with 10 additions and 78 deletions

View File

@ -1,48 +0,0 @@
kind: pipeline
type: kubernetes
name: build-amd64
platform:
arch: amd64
node_selector:
kubernetes.io/arch: amd64
steps:
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
- name: build-amd64
image: debian:bookworm-slim
commands:
- apt-get update
- apt-get -qy install gcc-12 cmake make build-essential
- mkdir build
- cd build; cmake ..
- make -j 4
- make test
---
kind: pipeline
type: kubernetes
name: build-arm64
platform:
arch: arm64
node_selector:
kubernetes.io/arch: arm64
steps:
- name: submodules
image: alpine/git
commands:
- git submodule update --init --recursive
- name: build-arm64
image: debian:bookworm-slim
commands:
- apt-get update
- apt-get -qy install gcc-12 cmake make build-essential
- mkdir build
- cd build; cmake ..
- make -j 4
- make test

View File

@ -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
bool isResponse_; std::atomic<bool> isResponse_;
/// emitter of the event /// emitter of the event
std::shared_ptr<EventManager::Participant> emitter_; std::shared_ptr<EventManager::Participant> emitter_;

View File

@ -181,13 +181,7 @@
* *
* @param manager - the manager to set * @param manager - the manager to set
*/ */
void setManager(std::shared_ptr<EventManager::Manager> manager) void setManager(std::shared_ptr<EventManager::Manager> manager) { manager_=manager;_subscribe(EVENT_TYPE_SHUTDOWN);}
{ manager_=manager;
if (manager_!=nullptr)
{
_subscribe(EVENT_TYPE_SHUTDOWN);
}
}
/** /**
* @brief Method to set the unique id of the participant * @brief Method to set the unique id of the participant

View File

@ -88,11 +88,8 @@
throw std::runtime_error("can not stop main thread"); throw std::runtime_error("can not stop main thread");
} }
if (mainThread_->joinable())
{
mainThread_->join(); mainThread_->join();
} }
}
void EventManager::Manager::stopScheduling_() void EventManager::Manager::stopScheduling_()
{ {
@ -110,11 +107,8 @@
throw std::runtime_error("can not stop scheduling thread"); throw std::runtime_error("can not stop scheduling thread");
} }
if (schedulingThread_->joinable())
{
schedulingThread_->join(); schedulingThread_->join();
} }
}
void EventManager::Manager::start() void EventManager::Manager::start()
{ {
@ -295,11 +289,6 @@
{ {
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)
{ {
if ( !(*it).second.empty()) if ( !(*it).second.empty())
@ -394,9 +383,6 @@ void EventManager::Manager::processDisconnect_( std::shared_ptr<EventManager::Pa
// before the participant gets disconnected it has to be unscheduled // before the participant gets disconnected it has to be unscheduled
processDisableScheduling_( participant ); processDisableScheduling_( participant );
// unsubscribe plugin from all events
unsubscribe(participant);
std::lock_guard<std::mutex> guard(mutexParticipants_); std::lock_guard<std::mutex> guard(mutexParticipants_);
auto it = std::find( participants_.begin(), participants_.end(), participant ); auto it = std::find( participants_.begin(), participants_.end(), participant );
if( it != participants_.end() ) if( it != participants_.end() )

View File

@ -87,11 +87,6 @@ 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;
@ -112,6 +107,11 @@ 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")