aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2019-01-30 10:29:03 -0500
committerJack Lloyd <[email protected]>2019-01-30 10:29:03 -0500
commitec82eca9477360ac1179a6f7a83cc986b84dc1de (patch)
tree62484d807b5775b3ba1c4f3296d965f0a9b4ce8c /src/lib/utils
parentddd802cd73ba09b19c8599f0a24e3cf086efe587 (diff)
Use std::mutex instead of mutex_type here
std::condition_variable only works with std::mutex anyway, and this module is not enabled on systems without threads.
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/thread_utils/barrier.cpp4
-rw-r--r--src/lib/utils/thread_utils/barrier.h4
-rw-r--r--src/lib/utils/thread_utils/semaphore.cpp4
-rw-r--r--src/lib/utils/thread_utils/semaphore.h4
4 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/utils/thread_utils/barrier.cpp b/src/lib/utils/thread_utils/barrier.cpp
index a5df95101..fae0b46dd 100644
--- a/src/lib/utils/thread_utils/barrier.cpp
+++ b/src/lib/utils/thread_utils/barrier.cpp
@@ -11,13 +11,13 @@ namespace Botan {
void Barrier::wait(size_t delta)
{
- lock_guard_type<mutex_type> lock(m_mutex);
+ lock_guard_type<std::mutex> lock(m_mutex);
m_value += delta;
}
void Barrier::sync()
{
- std::unique_lock<mutex_type> lock(m_mutex);
+ std::unique_lock<std::mutex> lock(m_mutex);
if(m_value > 1)
{
diff --git a/src/lib/utils/thread_utils/barrier.h b/src/lib/utils/thread_utils/barrier.h
index 874aa8abd..faa3188ef 100644
--- a/src/lib/utils/thread_utils/barrier.h
+++ b/src/lib/utils/thread_utils/barrier.h
@@ -8,7 +8,7 @@
#ifndef BOTAN_UTIL_BARRIER_H_
#define BOTAN_UTIL_BARRIER_H_
-#include <botan/mutex.h>
+#include <mutex>
#include <condition_variable>
namespace Botan {
@@ -33,7 +33,7 @@ class Barrier final
private:
int m_value;
size_t m_syncs;
- mutex_type m_mutex;
+ std::mutex m_mutex;
std::condition_variable m_cond;
};
diff --git a/src/lib/utils/thread_utils/semaphore.cpp b/src/lib/utils/thread_utils/semaphore.cpp
index 9a7af188a..2667d4e0c 100644
--- a/src/lib/utils/thread_utils/semaphore.cpp
+++ b/src/lib/utils/thread_utils/semaphore.cpp
@@ -15,7 +15,7 @@ void Semaphore::release(size_t n)
{
for(size_t i = 0; i != n; ++i)
{
- lock_guard_type<mutex_type> lock(m_mutex);
+ lock_guard_type<std::mutex> lock(m_mutex);
if(m_value++ < 0)
{
@@ -27,7 +27,7 @@ void Semaphore::release(size_t n)
void Semaphore::acquire()
{
- std::unique_lock<mutex_type> lock(m_mutex);
+ std::unique_lock<std::mutex> lock(m_mutex);
if(m_value-- <= 0)
{
m_cond.wait(lock, [this] { return m_wakeups > 0; });
diff --git a/src/lib/utils/thread_utils/semaphore.h b/src/lib/utils/thread_utils/semaphore.h
index 9db34826a..538d9ecb5 100644
--- a/src/lib/utils/thread_utils/semaphore.h
+++ b/src/lib/utils/thread_utils/semaphore.h
@@ -8,8 +8,8 @@
#ifndef BOTAN_SEMAPHORE_H_
#define BOTAN_SEMAPHORE_H_
-#include <botan/mutex.h>
#include <condition_variable>
+#include <mutex>
namespace Botan {
@@ -25,7 +25,7 @@ class Semaphore final
private:
int m_value;
int m_wakeups;
- mutex_type m_mutex;
+ std::mutex m_mutex;
std::condition_variable m_cond;
};