summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2017-11-14 13:32:24 +0100
committerTor Egge <Tor.Egge@broadpark.no>2017-11-14 13:32:24 +0100
commit740cb3830d82c8d59a1e6208041a780ca6cf3d03 (patch)
tree84399458da977d5b066bdc9dbd3f0100822c370f /searchcore
parent2d6c0542632a74d39f5b1176dee4cd2fa2f73d18 (diff)
Use std::mutex in searchcore MatchEngine.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h3
2 files changed, 8 insertions, 7 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
index 96ad422009c..83466cd51ad 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
@@ -62,7 +62,7 @@ MatchEngine::close()
{
LOG(debug, "Closing search interface.");
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
_closed = true;
}
@@ -74,21 +74,21 @@ ISearchHandler::SP
MatchEngine::putSearchHandler(const DocTypeName &docTypeName,
const ISearchHandler::SP &searchHandler)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.putHandler(docTypeName, searchHandler);
}
ISearchHandler::SP
MatchEngine::getSearchHandler(const DocTypeName &docTypeName)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.getHandler(docTypeName);
}
ISearchHandler::SP
MatchEngine::removeSearchHandler(const DocTypeName &docTypeName)
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
return _handlers.removeHandler(docTypeName);
}
@@ -121,7 +121,7 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req,
ISearchHandler::SP searchHandler;
vespalib::SimpleThreadBundle::UP threadBundle = _threadBundlePool.obtain();
{ // try to find the match handler corresponding to the specified search doc type
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
DocTypeName docTypeName(*req.get());
searchHandler = _handlers.getHandler(docTypeName);
}
@@ -130,7 +130,7 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req,
} else {
HandlerMap<ISearchHandler>::Snapshot::UP snapshot;
{
- vespalib::LockGuard guard(_lock);
+ std::lock_guard<std::mutex> guard(_lock);
snapshot = _handlers.snapshot();
}
if (snapshot->valid()) {
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
index 3055bbfb814..e27f1789ed3 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
@@ -9,6 +9,7 @@
#include <vespa/vespalib/net/state_explorer.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/util/simple_thread_bundle.h>
+#include <mutex>
namespace proton {
@@ -16,7 +17,7 @@ class MatchEngine : public search::engine::SearchServer,
public vespalib::StateExplorer
{
private:
- vespalib::Lock _lock;
+ std::mutex _lock;
const uint32_t _distributionKey;
bool _closed;
HandlerMap<ISearchHandler> _handlers;