diff options
author | Jack Lloyd <[email protected]> | 2016-10-17 03:11:14 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-17 03:11:14 -0400 |
commit | 0b353965a56dabf7528eecf672cc627304dbb8e1 (patch) | |
tree | dedfd4db3cc140f4a4c2fbba8a566742bc735fd2 /src/lib/utils/semaphore.cpp | |
parent | a816a52612cd8e9cf12bfdccaacc5ce7960b2700 (diff) | |
parent | 8b3bda479efecef760f052cc055d3d6d98bf0637 (diff) |
Merge GH #665 Add IncludeOS target, make filesystem/threads optional
Diffstat (limited to 'src/lib/utils/semaphore.cpp')
-rw-r--r-- | src/lib/utils/semaphore.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/utils/semaphore.cpp b/src/lib/utils/semaphore.cpp index f30c43661..62c31d3e3 100644 --- a/src/lib/utils/semaphore.cpp +++ b/src/lib/utils/semaphore.cpp @@ -7,6 +7,8 @@ #include <botan/internal/semaphore.h> +#if defined(BOTAN_TARGET_OS_HAS_THREADS) + // Based on code by Pierre Gaston (http://p9as.blogspot.com/2012/06/c11-semaphores.html) namespace Botan { @@ -15,7 +17,7 @@ void Semaphore::release(size_t n) { for(size_t i = 0; i != n; ++i) { - std::lock_guard<std::mutex> lock(m_mutex); + lock_guard_type<mutex_type> lock(m_mutex); ++m_value; @@ -29,7 +31,7 @@ void Semaphore::release(size_t n) void Semaphore::acquire() { - std::unique_lock<std::mutex> lock(m_mutex); + std::unique_lock<mutex_type> lock(m_mutex); --m_value; if(m_value < 0) { @@ -39,3 +41,5 @@ void Semaphore::acquire() } } + +#endif |