aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-13 08:09:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-13 08:09:04 +0200
commit61ac67105ef31e1ea31014e50e5b6deb74674594 (patch)
treee45e5be577d82b3c43a4cf94a833d17adb795a9e /libbuild2/utility.hxx
parentb01aaa16e5adaa0cc064490535f8756b2ef8d421 (diff)
Cache git status results in version module
Diffstat (limited to 'libbuild2/utility.hxx')
-rw-r--r--libbuild2/utility.hxx33
1 files changed, 0 insertions, 33 deletions
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> (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 <typename T>
- 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<string, T> cache_;
- mutable mutex mutex_;
- };
-
// File descriptor streams.
//
fdpipe