summaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/shared_mutex
diff options
context:
space:
mode:
Diffstat (limited to 'libstdc++-v3/include/std/shared_mutex')
-rw-r--r--libstdc++-v3/include/std/shared_mutex27
1 files changed, 13 insertions, 14 deletions
diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex
index ae5f199cdde..5ae492d42c7 100644
--- a/libstdc++-v3/include/std/shared_mutex
+++ b/libstdc++-v3/include/std/shared_mutex
@@ -36,7 +36,6 @@
#else
#include <bits/c++config.h>
-#include <mutex>
#include <condition_variable>
#include <bits/functexcept.h>
@@ -80,20 +79,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
int __ret = pthread_rwlock_init(&_M_rwlock, NULL);
if (__ret == ENOMEM)
- throw bad_alloc();
+ __throw_bad_alloc();
else if (__ret == EAGAIN)
__throw_system_error(int(errc::resource_unavailable_try_again));
else if (__ret == EPERM)
__throw_system_error(int(errc::operation_not_permitted));
// Errors not handled: EBUSY, EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
}
~__shared_mutex_pthread()
{
int __ret __attribute((__unused__)) = pthread_rwlock_destroy(&_M_rwlock);
// Errors not handled: EBUSY, EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
}
#endif
@@ -107,7 +106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ret == EDEADLK)
__throw_system_error(int(errc::resource_deadlock_would_occur));
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
}
bool
@@ -116,7 +115,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
int __ret = pthread_rwlock_trywrlock(&_M_rwlock);
if (__ret == EBUSY) return false;
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
return true;
}
@@ -125,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{
int __ret __attribute((__unused__)) = pthread_rwlock_unlock(&_M_rwlock);
// Errors not handled: EPERM, EBUSY, EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
}
// Shared ownership
@@ -144,7 +143,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ret == EDEADLK)
__throw_system_error(int(errc::resource_deadlock_would_occur));
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
}
bool
@@ -156,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// an exception.
if (__ret == EBUSY || __ret == EAGAIN) return false;
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
return true;
}
@@ -225,7 +224,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
~__shared_mutex_cv()
{
- _GLIBCXX_DEBUG_ASSERT( _M_state == 0 );
+ __glibcxx_assert( _M_state == 0 );
}
__shared_mutex_cv(const __shared_mutex_cv&) = delete;
@@ -260,7 +259,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
unlock()
{
lock_guard<mutex> __lk(_M_mut);
- _GLIBCXX_DEBUG_ASSERT( _M_write_entered() );
+ __glibcxx_assert( _M_write_entered() );
_M_state = 0;
// call notify_all() while mutex is held so that another thread can't
// lock and unlock the mutex then destroy *this before we make the call.
@@ -295,7 +294,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
unlock_shared()
{
lock_guard<mutex> __lk(_M_mut);
- _GLIBCXX_DEBUG_ASSERT( _M_readers() > 0 );
+ __glibcxx_assert( _M_readers() > 0 );
auto __prev = _M_state--;
if (_M_write_entered())
{
@@ -423,7 +422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ret == ETIMEDOUT || __ret == EDEADLK)
return false;
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
return true;
}
@@ -475,7 +474,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ret == ETIMEDOUT)
return false;
// Errors not handled: EINVAL
- _GLIBCXX_DEBUG_ASSERT(__ret == 0);
+ __glibcxx_assert(__ret == 0);
return true;
}