From c26d98ef7599524bfd0f27403ce4e745b16af703 Mon Sep 17 00:00:00 2001 From: Florian Tschopp Date: Fri, 22 Mar 2024 17:21:05 +0100 Subject: [PATCH] terminate when distructed before stopped --- modules/concurrency/src/spinner.cpp | 10 ++++------ modules/utils/src/version_impl.h | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/concurrency/src/spinner.cpp b/modules/concurrency/src/spinner.cpp index 74450d04..db965641 100644 --- a/modules/concurrency/src/spinner.cpp +++ b/modules/concurrency/src/spinner.cpp @@ -4,6 +4,7 @@ #include "hephaestus/concurrency/spinner.h" +#include #include #include "hephaestus/base/exception.h" @@ -13,12 +14,9 @@ Spinner::Spinner() : is_started_(false) { } Spinner::~Spinner() { - try { - if (is_started_.load() && spinner_thread_.joinable()) { - stop(); - } - } catch (const std::exception& ex) { - fmt::print("Error stopping spinner: {}", ex.what()); + if (is_started_.load() || spinner_thread_.joinable()) { + LOG(FATAL) << "Spinner is still running. Call stop() before destroying the object."; + std::terminate(); } } diff --git a/modules/utils/src/version_impl.h b/modules/utils/src/version_impl.h index 64ac6ae5..339026a1 100644 --- a/modules/utils/src/version_impl.h +++ b/modules/utils/src/version_impl.h @@ -19,6 +19,6 @@ static constexpr std::uint16_t VERSION_PATCH = 1; static constexpr std::string_view REPO_BRANCH = "feature/spinner"; static constexpr std::string_view BUILD_PROFILE = "RelWithDebInfo"; -static constexpr std::string_view REPO_HASH = "955d99b"; +static constexpr std::string_view REPO_HASH = "bd3be14"; } // namespace heph::utils