From 5f6ff55e97104e46c1b5c2c94b39ea0fca35ca7c Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 7 Mar 2024 15:44:28 +0100 Subject: just: Replace singletons for progress tracking and statistics... ...with regular instances that have controlled life-times. This avoids race conditions in tracking and reporting the results of analysis and build, as the serve endpoint can orchestrate multiple builds at the same time asynchronously. As a bonus side-effect this also ensures the correctness of the progress reporting per orchestrated build. --- src/buildtool/progress_reporting/progress_reporter.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/buildtool/progress_reporting/progress_reporter.hpp') diff --git a/src/buildtool/progress_reporting/progress_reporter.hpp b/src/buildtool/progress_reporting/progress_reporter.hpp index 5323578f..1c4206de 100644 --- a/src/buildtool/progress_reporting/progress_reporter.hpp +++ b/src/buildtool/progress_reporting/progress_reporter.hpp @@ -15,11 +15,17 @@ #ifndef INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_PROGRESS_REPORTER_HPP #define INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_PROGRESS_REPORTER_HPP +#include "gsl/gsl" +#include "src/buildtool/common/statistics.hpp" #include "src/buildtool/progress_reporting/base_progress_reporter.hpp" +#include "src/buildtool/progress_reporting/progress.hpp" class ProgressReporter { public: - [[nodiscard]] static auto Reporter() noexcept -> progress_reporter_t; + [[nodiscard]] static auto Reporter( + gsl::not_null const& stats, + gsl::not_null const& progress) noexcept + -> progress_reporter_t; }; #endif // INCLUDED_SRC_BUILDTOOL_PROGRESS_REPORTING_PROGRESS_REPORTER_HPP -- cgit v1.2.3