summaryrefslogtreecommitdiffstats
path: root/storageframework
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-11-24 10:49:28 +0000
committerTor Egge <Tor.Egge@oath.com>2017-11-24 11:41:25 +0000
commit49752dd142b687d74dcd00dfe1198d8933e74ee1 (patch)
tree58c1570188a2bb6d216225db7af0072abc39c687 /storageframework
parent150c057fd45fb34556e55ee82a614e27c878f3ea (diff)
Use standard locking in StorageBucketDBInitializer.
Diffstat (limited to 'storageframework')
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/thread.cpp11
-rw-r--r--storageframework/src/vespa/storageframework/generic/thread/thread.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/storageframework/src/vespa/storageframework/generic/thread/thread.cpp b/storageframework/src/vespa/storageframework/generic/thread/thread.cpp
index 1a88b4d2044..5ed3f7dc5e6 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/thread.cpp
+++ b/storageframework/src/vespa/storageframework/generic/thread/thread.cpp
@@ -17,5 +17,16 @@ Thread::interruptAndJoin(vespalib::Monitor* m)
join();
}
+void
+Thread::interruptAndJoin(std::mutex &m, std::condition_variable &cv)
+{
+ interrupt();
+ {
+ std::lock_guard<std::mutex> guard(m);
+ cv.notify_all();
+ }
+ join();
+}
+
} // framework
} // storage
diff --git a/storageframework/src/vespa/storageframework/generic/thread/thread.h b/storageframework/src/vespa/storageframework/generic/thread/thread.h
index ceeba79ebe2..72054ff725a 100644
--- a/storageframework/src/vespa/storageframework/generic/thread/thread.h
+++ b/storageframework/src/vespa/storageframework/generic/thread/thread.h
@@ -14,6 +14,8 @@
#include "runnable.h"
#include <vespa/vespalib/stllike/string.h>
+#include <mutex>
+#include <condition_variable>
namespace vespalib {
class Monitor;
@@ -58,6 +60,8 @@ public:
* through a monitor after the signalling face.
*/
void interruptAndJoin(vespalib::Monitor* m);
+
+ void interruptAndJoin(std::mutex &m, std::condition_variable &cv);
};
}