summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/shared_mutex.cpp
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2015-10-06 17:53:29 +0000
committerdim <dim@FreeBSD.org>2015-10-06 17:53:29 +0000
commita6f4f28b545e1f0632ba4b20b86a7ab487932373 (patch)
treee9dbc6d658415636ba47d28716ee528c8ab7c862 /contrib/libc++/src/shared_mutex.cpp
parent09f0c012db173aa7875b4d45fc67ef4d26c82548 (diff)
parent9ba87e73be0d01bbe1cf9547130ae12f9b15d7a7 (diff)
downloadFreeBSD-src-a6f4f28b545e1f0632ba4b20b86a7ab487932373.zip
FreeBSD-src-a6f4f28b545e1f0632ba4b20b86a7ab487932373.tar.gz
Upgrade our copies of clang, llvm, lldb, compiler-rt and libc++ to 3.7.0
release. Please note that from 3.5.0 onwards, clang, llvm and lldb require C++11 support to build; see UPDATING for more information. Release notes for llvm and clang can be found here: <http://llvm.org/releases/3.7.0/docs/ReleaseNotes.html> <http://llvm.org/releases/3.7.0/tools/clang/docs/ReleaseNotes.html> Thanks to Ed Maste, Andrew Turner and Antoine Brodin for their help. Exp-run: antoine Relnotes: yes
Diffstat (limited to 'contrib/libc++/src/shared_mutex.cpp')
-rw-r--r--contrib/libc++/src/shared_mutex.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/contrib/libc++/src/shared_mutex.cpp b/contrib/libc++/src/shared_mutex.cpp
index 2b78c1f..874aceb 100644
--- a/contrib/libc++/src/shared_mutex.cpp
+++ b/contrib/libc++/src/shared_mutex.cpp
@@ -15,7 +15,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-shared_timed_mutex::shared_timed_mutex()
+// Shared Mutex Base
+__shared_mutex_base::__shared_mutex_base()
: __state_(0)
{
}
@@ -23,7 +24,7 @@ shared_timed_mutex::shared_timed_mutex()
// Exclusive ownership
void
-shared_timed_mutex::lock()
+__shared_mutex_base::lock()
{
unique_lock<mutex> lk(__mut_);
while (__state_ & __write_entered_)
@@ -34,7 +35,7 @@ shared_timed_mutex::lock()
}
bool
-shared_timed_mutex::try_lock()
+__shared_mutex_base::try_lock()
{
unique_lock<mutex> lk(__mut_);
if (__state_ == 0)
@@ -46,7 +47,7 @@ shared_timed_mutex::try_lock()
}
void
-shared_timed_mutex::unlock()
+__shared_mutex_base::unlock()
{
lock_guard<mutex> _(__mut_);
__state_ = 0;
@@ -56,7 +57,7 @@ shared_timed_mutex::unlock()
// Shared ownership
void
-shared_timed_mutex::lock_shared()
+__shared_mutex_base::lock_shared()
{
unique_lock<mutex> lk(__mut_);
while ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
@@ -67,7 +68,7 @@ shared_timed_mutex::lock_shared()
}
bool
-shared_timed_mutex::try_lock_shared()
+__shared_mutex_base::try_lock_shared()
{
unique_lock<mutex> lk(__mut_);
unsigned num_readers = __state_ & __n_readers_;
@@ -82,7 +83,7 @@ shared_timed_mutex::try_lock_shared()
}
void
-shared_timed_mutex::unlock_shared()
+__shared_mutex_base::unlock_shared()
{
lock_guard<mutex> _(__mut_);
unsigned num_readers = (__state_ & __n_readers_) - 1;
@@ -101,6 +102,16 @@ shared_timed_mutex::unlock_shared()
}
+// Shared Timed Mutex
+// These routines are here for ABI stability
+shared_timed_mutex::shared_timed_mutex() : __base() {}
+void shared_timed_mutex::lock() { return __base.lock(); }
+bool shared_timed_mutex::try_lock() { return __base.try_lock(); }
+void shared_timed_mutex::unlock() { return __base.unlock(); }
+void shared_timed_mutex::lock_shared() { return __base.lock_shared(); }
+bool shared_timed_mutex::try_lock_shared() { return __base.try_lock_shared(); }
+void shared_timed_mutex::unlock_shared() { return __base.unlock_shared(); }
+
_LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
OpenPOWER on IntegriCloud