diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-08 21:57:35 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-08 21:57:35 +0000 |
commit | a51725cfc47c215785ac4b24c6e18bf3d5ea475b (patch) | |
tree | 42abc8a4ac1783f0816ffcdd7b85c30e07e7e3d3 /staging_vespalib/src | |
parent | a4d0cd759eed68318afebbaddbc4baddc70416e2 (diff) |
- GC the last usages of vespalib::Lock.
- Now it is only vespalib::Monitor left
Diffstat (limited to 'staging_vespalib/src')
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/stllike/cache.h | 5 | ||||
-rw-r--r-- | staging_vespalib/src/vespa/vespalib/stllike/cache.hpp | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/staging_vespalib/src/vespa/vespalib/stllike/cache.h b/staging_vespalib/src/vespa/vespalib/stllike/cache.h index d0491e4d246..798fdb70138 100644 --- a/staging_vespalib/src/vespa/vespalib/stllike/cache.h +++ b/staging_vespalib/src/vespa/vespalib/stllike/cache.h @@ -2,7 +2,6 @@ #pragma once #include <vespa/vespalib/stllike/lrucache_map.h> -#include <vespa/vespalib/util/sync.h> #include <atomic> namespace vespalib { @@ -134,7 +133,7 @@ private: */ bool removeOldest(const value_type & v) override; size_t calcSize(const K & k, const V & v) const { return sizeof(value_type) + _sizeK(k) + _sizeV(v); } - vespalib::Lock & getLock(const K & k) { + std::mutex & getLock(const K & k) { size_t h(_hasher(k)); return _addLocks[h%(sizeof(_addLocks)/sizeof(_addLocks[0]))]; } @@ -156,7 +155,7 @@ private: BackingStore & _store; mutable std::mutex _hashLock; /// Striped locks that can be used for having a locked access to the backing store. - vespalib::Lock _addLocks[113]; + std::mutex _addLocks[113]; }; } diff --git a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp index 652abc6672b..719169ba747 100644 --- a/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp +++ b/staging_vespalib/src/vespa/vespalib/stllike/cache.hpp @@ -92,7 +92,7 @@ cache<P>::read(const K & key) } } - vespalib::LockGuard storeGuard(getLock(key)); + std::lock_guard storeGuard(getLock(key)); { std::lock_guard guard(_hashLock); if (Lru::hasKey(key)) { @@ -118,7 +118,7 @@ void cache<P>::write(const K & key, V value) { size_t newSize = calcSize(key, value); - vespalib::LockGuard storeGuard(getLock(key)); + std::lock_guard storeGuard(getLock(key)); { std::lock_guard guard(_hashLock); if (Lru::hasKey(key)) { @@ -140,7 +140,7 @@ template< typename P > void cache<P>::erase(const K & key) { - vespalib::LockGuard storeGuard(getLock(key)); + std::lock_guard storeGuard(getLock(key)); invalidate(key); _store.erase(key); } |