From 5afec8256a6d974537631eb81363693c1cc4ea0f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Jan 2020 09:21:56 +0100 Subject: [PATCH] Main: move code to Partition::BeginShutdown() --- src/Main.cxx | 4 +--- src/Partition.cxx | 7 +++++++ src/Partition.hxx | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Main.cxx b/src/Main.cxx index ee35ad246..d98e279fe 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -27,7 +27,6 @@ #include "Mapper.hxx" #include "Permission.hxx" #include "Listen.hxx" -#include "client/Listener.hxx" #include "client/Config.hxx" #include "client/List.hxx" #include "command/AllCommands.hxx" @@ -349,8 +348,7 @@ inline void Instance::BeginShutdownPartitions() noexcept { for (auto &partition : partitions) { - partition.pc.Kill(); - partition.listener.reset(); + partition.BeginShutdown(); } } diff --git a/src/Partition.cxx b/src/Partition.cxx index 58fec1a11..5c31e9ecd 100644 --- a/src/Partition.cxx +++ b/src/Partition.cxx @@ -52,6 +52,13 @@ Partition::Partition(Instance &_instance, Partition::~Partition() noexcept = default; +void +Partition::BeginShutdown() noexcept +{ + pc.Kill(); + listener.reset(); +} + void Partition::EmitIdle(unsigned mask) noexcept { diff --git a/src/Partition.hxx b/src/Partition.hxx index e86c812b6..7c7d30673 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -74,6 +74,8 @@ struct Partition final : QueueListener, PlayerListener, MixerListener { ~Partition() noexcept; + void BeginShutdown() noexcept; + void EmitGlobalEvent(unsigned mask) noexcept { global_events.OrMask(mask); }