Commit 608879a9 authored by Dominik Charousset's avatar Dominik Charousset

Log individual module shutdown

parent 710eccb4
...@@ -19,13 +19,14 @@ ...@@ -19,13 +19,14 @@
#pragma once #pragma once
#include <array> #include <array>
#include <mutex>
#include <atomic> #include <atomic>
#include <string> #include <condition_variable>
#include <memory>
#include <cstddef> #include <cstddef>
#include <functional> #include <functional>
#include <condition_variable> #include <memory>
#include <mutex>
#include <string>
#include <typeinfo>
#include "caf/abstract_actor.hpp" #include "caf/abstract_actor.hpp"
#include "caf/actor_cast.hpp" #include "caf/actor_cast.hpp"
...@@ -164,6 +165,9 @@ public: ...@@ -164,6 +165,9 @@ public:
virtual ~module(); virtual ~module();
/// Returns the human-redable name of the module.
const char* name() const noexcept;
/// Starts any background threads needed by the module. /// Starts any background threads needed by the module.
virtual void start() = 0; virtual void start() = 0;
......
...@@ -203,6 +203,21 @@ actor_system::module::~module() { ...@@ -203,6 +203,21 @@ actor_system::module::~module() {
// nop // nop
} }
const char* actor_system::module::name() const noexcept {
switch (id()) {
case scheduler:
return "Scheduler";
case middleman:
return "Middleman";
case opencl_manager:
return "OpenCL Manager";
case openssl_manager:
return "OpenSSL Manager";
default:
return "???";
}
}
actor_system::actor_system(actor_system_config& cfg) actor_system::actor_system(actor_system_config& cfg)
: ids_(0), : ids_(0),
types_(*this), types_(*this),
...@@ -310,9 +325,13 @@ actor_system::~actor_system() { ...@@ -310,9 +325,13 @@ actor_system::~actor_system() {
// group module is the first one, relies on MM // group module is the first one, relies on MM
groups_.stop(); groups_.stop();
// stop modules in reverse order // stop modules in reverse order
for (auto i = modules_.rbegin(); i != modules_.rend(); ++i) for (auto i = modules_.rbegin(); i != modules_.rend(); ++i) {
if (*i) auto& ptr = *i;
(*i)->stop(); if (ptr != nullptr) {
CAF_LOG_DEBUG("stop module" << ptr->name());
ptr->stop();
}
}
await_detached_threads(); await_detached_threads();
registry_.stop(); registry_.stop();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment