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

Log individual module shutdown

parent 710eccb4
......@@ -19,13 +19,14 @@
#pragma once
#include <array>
#include <mutex>
#include <atomic>
#include <string>
#include <memory>
#include <condition_variable>
#include <cstddef>
#include <functional>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <string>
#include <typeinfo>
#include "caf/abstract_actor.hpp"
#include "caf/actor_cast.hpp"
......@@ -164,6 +165,9 @@ public:
virtual ~module();
/// Returns the human-redable name of the module.
const char* name() const noexcept;
/// Starts any background threads needed by the module.
virtual void start() = 0;
......
......@@ -203,6 +203,21 @@ actor_system::module::~module() {
// 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)
: ids_(0),
types_(*this),
......@@ -310,9 +325,13 @@ actor_system::~actor_system() {
// group module is the first one, relies on MM
groups_.stop();
// stop modules in reverse order
for (auto i = modules_.rbegin(); i != modules_.rend(); ++i)
if (*i)
(*i)->stop();
for (auto i = modules_.rbegin(); i != modules_.rend(); ++i) {
auto& ptr = *i;
if (ptr != nullptr) {
CAF_LOG_DEBUG("stop module" << ptr->name());
ptr->stop();
}
}
await_detached_threads();
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