diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-08 08:24:55 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-08 08:24:55 +0000 |
commit | 3b3ea0cf9c580e658abab59d1d020d9db9ec9cb9 (patch) | |
tree | 6d6b9b74ef716f09b17aaf24ca63760578837843 /documentapi | |
parent | 4291a9ec03e9b5b7c23473725678b3c0785cbf91 (diff) |
Use vespalib::Lock -> std::mutex
Diffstat (limited to 'documentapi')
4 files changed, 13 insertions, 13 deletions
diff --git a/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp b/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp index c7f3401d3e1..6ed33cda060 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routablerepository.cpp @@ -109,7 +109,7 @@ void RoutableRepository::putFactory(const vespalib::VersionSpecification &version, uint32_t type, IRoutableFactory::SP factory) { - vespalib::LockGuard guard(_lock); + std::lock_guard guard(_lock); if (_factoryTypes[type].putFactory(version, factory)) { _cache.clear(); } @@ -118,7 +118,7 @@ RoutableRepository::putFactory(const vespalib::VersionSpecification &version, IRoutableFactory::SP RoutableRepository::getFactory(const vespalib::Version &version, uint32_t type) const { - vespalib::LockGuard guard(_lock); + std::lock_guard guard(_lock); CacheKey cacheKey(version, type); FactoryCache::const_iterator cit = _cache.find(cacheKey); if (cit != _cache.end()) { @@ -139,7 +139,7 @@ RoutableRepository::getFactory(const vespalib::Version &version, uint32_t type) uint32_t RoutableRepository::getRoutableTypes(const vespalib::Version &version, std::vector<uint32_t> &out) const { - vespalib::LockGuard guard(_lock); + std::lock_guard guard(_lock); for (const auto & type : _factoryTypes) { if (type.second.getFactory(version)) { out.push_back(type.first); diff --git a/documentapi/src/vespa/documentapi/messagebus/routablerepository.h b/documentapi/src/vespa/documentapi/messagebus/routablerepository.h index f4bddad45b4..7e73f3929b8 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routablerepository.h +++ b/documentapi/src/vespa/documentapi/messagebus/routablerepository.h @@ -1,11 +1,11 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <map> +#include "iroutablefactory.h" #include <vespa/messagebus/blobref.h> -#include <vespa/vespalib/util/sync.h> #include <vespa/vespalib/component/versionspecification.h> -#include "iroutablefactory.h" +#include <mutex> +#include <map> namespace documentapi { @@ -37,7 +37,7 @@ private: typedef std::map<CacheKey, IRoutableFactory::SP> FactoryCache; typedef std::map<uint32_t, VersionMap> TypeMap; - vespalib::Lock _lock; + mutable std::mutex _lock; TypeMap _factoryTypes; mutable FactoryCache _cache; const LoadTypeSet& _loadTypes; @@ -48,7 +48,7 @@ public: /** * Constructs a new routable repository. */ - RoutableRepository(const LoadTypeSet& loadTypes); + explicit RoutableRepository(const LoadTypeSet& loadTypes); /** * Decodes a {@link Routable} from the given byte array. This uses the content of the byte array to diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.cpp b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.cpp index 3c73cda786d..c21d8e97880 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.cpp +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.cpp @@ -17,14 +17,14 @@ RoutingPolicyRepository::RoutingPolicyRepository() : void RoutingPolicyRepository::putFactory(const string &name, IRoutingPolicyFactory::SP factory) { - vespalib::LockGuard guard(_lock); + std::lock_guard guard(_lock); _factories[name] = factory; } IRoutingPolicyFactory::SP RoutingPolicyRepository::getFactory(const string &name) const { - vespalib::LockGuard guard(_lock); + std::lock_guard guard(_lock); FactoryMap::const_iterator it = _factories.find(name); if (it != _factories.end()) { return it->second; diff --git a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h index ca6057ef8b1..beeb176c88b 100644 --- a/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h +++ b/documentapi/src/vespa/documentapi/messagebus/routingpolicyrepository.h @@ -2,8 +2,8 @@ #pragma once #include "iroutingpolicyfactory.h" -#include <vespa/vespalib/util/sync.h> #include <map> +#include <mutex> namespace documentapi { @@ -11,8 +11,8 @@ class RoutingPolicyRepository { private: typedef std::map<string, IRoutingPolicyFactory::SP> FactoryMap; - vespalib::Lock _lock; - FactoryMap _factories; + mutable std::mutex _lock; + FactoryMap _factories; public: RoutingPolicyRepository(const RoutingPolicyRepository &) = delete; |