aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils/semaphore.h
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2016-10-12 15:32:14 -0400
committerJack Lloyd <[email protected]>2016-10-12 15:32:14 -0400
commited9e147695e4c5e800e83654baf365a634f3a2a7 (patch)
tree59bad402cff7d7af9baa5fd79081d677b60afc83 /src/lib/utils/semaphore.h
parentd59b164a2ad2bc2290265530ac1a5c7be7855975 (diff)
Abstract out mutex type. Make threads optional.
Diffstat (limited to 'src/lib/utils/semaphore.h')
-rw-r--r--src/lib/utils/semaphore.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/utils/semaphore.h b/src/lib/utils/semaphore.h
index 994a15f21..87e6b84fe 100644
--- a/src/lib/utils/semaphore.h
+++ b/src/lib/utils/semaphore.h
@@ -8,11 +8,15 @@
#ifndef BOTAN_SEMAPHORE_H__
#define BOTAN_SEMAPHORE_H__
-#include <mutex>
+#include <botan/mutex.h>
+
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
#include <condition_variable>
+#endif
namespace Botan {
+#if defined(BOTAN_TARGET_OS_HAS_THREADS)
class Semaphore
{
public:
@@ -25,9 +29,10 @@ class Semaphore
private:
int m_value;
int m_wakeups;
- std::mutex m_mutex;
+ mutex_type m_mutex;
std::condition_variable m_cond;
};
+#endif
}