Commit 78e185c8 authored by Jakob Otto's avatar Jakob Otto

Add distinction for manual multiplexing

parent 55716d22
......@@ -93,7 +93,9 @@ public:
void run();
/// Signals the multiplexer to initiate shutdown.
void shutdown();
/// @returns true if manual triggering is needed, false if not.
/// @thread-safe
bool shutdown();
protected:
// -- utility functions ------------------------------------------------------
......
......@@ -232,7 +232,7 @@ void multiplexer::run() {
poll_once(true);
}
void multiplexer::shutdown() {
bool multiplexer::shutdown() {
if (std::this_thread::get_id() == tid_) {
will_shutdown_ = true;
if (managers_.size() == 1) {
......@@ -242,8 +242,10 @@ void multiplexer::shutdown() {
for (size_t i = 1; i < managers_.size(); ++i)
write_to_pipe(4, managers_[i]);
}
return true;
} else {
write_to_pipe(5, nullptr);
return false;
}
}
......
......@@ -55,11 +55,11 @@ void middleman::start() {
void middleman::stop() {
for (const auto& backend : backends_)
backend->stop();
mpx_->shutdown();
// TODO: Implement shutdown for multiplexer running in own thread!
// if (mpx_thread_.joinable())
// mpx_thread_.join();
if (mpx_->shutdown()) {
mpx_->run();
} else if (mpx_thread_.joinable()) {
mpx_thread_.join();
}
}
void middleman::init(actor_system_config& cfg) {
......
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