aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-12-12 13:01:15 +0000
committerTor Egge <Tor.Egge@oath.com>2017-12-12 13:01:15 +0000
commit9408c19cd6d340d9d2f09c67699e67afd62fbb12 (patch)
tree48e3f148b55281a96a718c52db458fbbbc50e528 /searchlib/src/tests/attribute
parentad70d622d76fd6a59272b16da1a3787d5f85c193 (diff)
Use standard locking in searchlib (pass 1).
Diffstat (limited to 'searchlib/src/tests/attribute')
-rw-r--r--searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp2
-rw-r--r--searchlib/src/tests/attribute/runnable.h24
2 files changed, 13 insertions, 13 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
index 8eef498d85c..e2dc6b2b2ef 100644
--- a/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
+++ b/searchlib/src/tests/attribute/benchmark/attributebenchmark.cpp
@@ -21,8 +21,6 @@ LOG_SETUP("attributebenchmark");
#include <vespa/searchlib/attribute/attributevector.hpp>
-using vespalib::Monitor;
-using vespalib::MonitorGuard;
using std::shared_ptr;
typedef std::vector<uint32_t> NumVector;
diff --git a/searchlib/src/tests/attribute/runnable.h b/searchlib/src/tests/attribute/runnable.h
index b95d7d3843f..fb0a7cb1825 100644
--- a/searchlib/src/tests/attribute/runnable.h
+++ b/searchlib/src/tests/attribute/runnable.h
@@ -2,7 +2,8 @@
#pragma once
-#include <vespa/vespalib/util/sync.h>
+#include <mutex>
+#include <condition_variable>
#include <vespa/fastos/thread.h>
namespace search {
@@ -10,31 +11,32 @@ namespace search {
class Runnable : public FastOS_Runnable
{
protected:
- uint32_t _id;
- vespalib::Monitor _cond;
- bool _done;
- bool _stopped;
+ uint32_t _id;
+ std::mutex _lock;
+ std::condition_variable _cond;
+ bool _done;
+ bool _stopped;
public:
Runnable(uint32_t id) :
- _id(id), _cond(), _done(false), _stopped(false)
+ _id(id), _lock(), _cond(), _done(false), _stopped(false)
{ }
void Run(FastOS_ThreadInterface *, void *) override {
doRun();
- vespalib::MonitorGuard guard(_cond);
+ std::lock_guard<std::mutex> guard(_lock);
_stopped = true;
- guard.broadcast();
+ _cond.notify_all();
}
virtual void doRun() = 0;
void stop() {
- vespalib::MonitorGuard guard(_cond);
+ std::lock_guard<std::mutex> guard(_lock);
_done = true;
}
void join() {
- vespalib::MonitorGuard guard(_cond);
+ std::unique_lock<std::mutex> guard(_lock);
while (!_stopped) {
- guard.wait();
+ _cond.wait(guard);
}
}
};