summaryrefslogtreecommitdiffstats
path: root/staging_vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 20:29:40 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-07 20:53:05 +0000
commit356172042cbc96375be8d663a945879b9f10dd41 (patch)
treee77fb1af93766b3655df04a55a9fa5dee6ef7971 /staging_vespalib
parent379b3d8c3ce128da5a985ed73fce99326369512c (diff)
- GC unused code.
- vespalib::Lock -> std::mutex
Diffstat (limited to 'staging_vespalib')
-rw-r--r--staging_vespalib/src/vespa/vespalib/stllike/cache.h1
-rw-r--r--staging_vespalib/src/vespa/vespalib/stllike/cache.hpp8
-rw-r--r--staging_vespalib/src/vespa/vespalib/util/varholder.h8
3 files changed, 5 insertions, 12 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/stllike/cache.h b/staging_vespalib/src/vespa/vespalib/stllike/cache.h
index 99b601f7c3c..2c7722724cf 100644
--- a/staging_vespalib/src/vespa/vespalib/stllike/cache.h
+++ b/staging_vespalib/src/vespa/vespalib/stllike/cache.h
@@ -123,7 +123,6 @@ protected:
vespalib::LockGuard getGuard();
void invalidate(const vespalib::LockGuard & guard, const K & key);
bool hasKey(const vespalib::LockGuard & guard, const K & key) const;
- bool hasLock() const;
private:
/**
* Called when an object is inserted, to see if the LRU should be removed.
diff --git a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp
index 906621d623c..ebad3ef6a09 100644
--- a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp
+++ b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp
@@ -42,13 +42,7 @@ cache<P>::hasKey(const K & key) const {
}
template< typename P >
-bool
-cache<P>::hasLock() const {
- return TryLock(_hashLock).hasLock();
-}
-
-template< typename P >
-cache<P>::~cache() { }
+cache<P>::~cache() = default;
template< typename P >
cache<P>::cache(BackingStore & b, size_t maxBytes) :
diff --git a/staging_vespalib/src/vespa/vespalib/util/varholder.h b/staging_vespalib/src/vespa/vespalib/util/varholder.h
index fdcc15d1fb4..980d773adc4 100644
--- a/staging_vespalib/src/vespa/vespalib/util/varholder.h
+++ b/staging_vespalib/src/vespa/vespalib/util/varholder.h
@@ -2,7 +2,7 @@
#pragma once
-#include <vespa/vespalib/util/sync.h>
+#include <mutex>
namespace vespalib {
@@ -10,7 +10,7 @@ template <typename T>
class VarHolder
{
T _v;
- Lock _lock;
+ std::mutex _lock;
public:
VarHolder() : _v(), _lock() {}
explicit VarHolder(const T &v) : _v(v), _lock() {}
@@ -21,7 +21,7 @@ public:
void set(const T &v) {
T old;
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
old = _v;
_v = v;
}
@@ -30,7 +30,7 @@ public:
void clear() { set(T()); }
T get() const {
- vespalib::LockGuard guard(_lock);
+ std::lock_guard guard(_lock);
return _v;
}
};