From 61ac67105ef31e1ea31014e50e5b6deb74674594 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 13 Aug 2021 08:09:04 +0200 Subject: Cache git status results in version module --- libbuild2/utility.hxx | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'libbuild2/utility.hxx') diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx index c3e1921..c7ee2f4 100644 --- a/libbuild2/utility.hxx +++ b/libbuild2/utility.hxx @@ -535,39 +535,6 @@ namespace build2 verbosity, pe, args, forward (f), error, ignore_exit, checksum); } - // Global, MT-safe information cache. Normally used for caching information - // (versions, targets, search paths, etc) extracted from other programs - // (compilers, etc). - // - // The key is normally a hash of all the inputs that can affect the output. - // - // Note that insertion is racy and it's possible the cache entry already - // exists, in which case we ignore our value assuming it is the same. - // - template - class global_cache - { - public: - const T* - find (const string& k) const - { - mlock l (mutex_); - auto i (cache_.find (k)); - return i != cache_.end () ? &i->second : nullptr; - } - - const T& - insert (string k, T v) - { - mlock l (mutex_); - return cache_.insert (make_pair (move (k), move (v))).first->second; - } - - private: - map cache_; - mutable mutex mutex_; - }; - // File descriptor streams. // fdpipe -- cgit v1.1