From c788c76dc9d6e6fdfa67557ea5febefddd106dac Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Apr 2017 23:15:46 +0200 Subject: [PATCH] output/Internal: add method IsBusy() --- src/output/Internal.hxx | 7 +++++++ src/output/MultipleOutputs.cxx | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/output/Internal.hxx b/src/output/Internal.hxx index 8ca6b1276..68cb9abaf 100644 --- a/src/output/Internal.hxx +++ b/src/output/Internal.hxx @@ -313,6 +313,13 @@ public: return command == Command::NONE; } + /** + * Caller must lock the mutex. + */ + bool IsBusy() const { + return IsOpen() && !IsCommandFinished(); + } + /** * Caller must lock the mutex. */ diff --git a/src/output/MultipleOutputs.cxx b/src/output/MultipleOutputs.cxx index 5cf7b0a40..c3d584652 100644 --- a/src/output/MultipleOutputs.cxx +++ b/src/output/MultipleOutputs.cxx @@ -138,7 +138,7 @@ MultipleOutputs::AllFinished() const { for (auto ao : outputs) { const std::lock_guard protect(ao->mutex); - if (ao->IsOpen() && !ao->IsCommandFinished()) + if (ao->IsBusy()) return false; }