Implement N3891: A proposal to rename shared_mutex to shared_timed_mutex
This is as straightforward as it sounds, a renamed from shared_mutex to shared_timed_mutex. Note that libcxx .dylib and .so files built with c++14 support need to be rebuilt. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@204078 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
shared_mutex::shared_mutex()
|
||||
shared_timed_mutex::shared_timed_mutex()
|
||||
: __state_(0)
|
||||
{
|
||||
}
|
||||
@@ -20,7 +20,7 @@ shared_mutex::shared_mutex()
|
||||
// Exclusive ownership
|
||||
|
||||
void
|
||||
shared_mutex::lock()
|
||||
shared_timed_mutex::lock()
|
||||
{
|
||||
unique_lock<mutex> lk(__mut_);
|
||||
while (__state_ & __write_entered_)
|
||||
@@ -31,7 +31,7 @@ shared_mutex::lock()
|
||||
}
|
||||
|
||||
bool
|
||||
shared_mutex::try_lock()
|
||||
shared_timed_mutex::try_lock()
|
||||
{
|
||||
unique_lock<mutex> lk(__mut_);
|
||||
if (__state_ == 0)
|
||||
@@ -43,7 +43,7 @@ shared_mutex::try_lock()
|
||||
}
|
||||
|
||||
void
|
||||
shared_mutex::unlock()
|
||||
shared_timed_mutex::unlock()
|
||||
{
|
||||
lock_guard<mutex> _(__mut_);
|
||||
__state_ = 0;
|
||||
@@ -53,7 +53,7 @@ shared_mutex::unlock()
|
||||
// Shared ownership
|
||||
|
||||
void
|
||||
shared_mutex::lock_shared()
|
||||
shared_timed_mutex::lock_shared()
|
||||
{
|
||||
unique_lock<mutex> lk(__mut_);
|
||||
while ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
|
||||
@@ -64,7 +64,7 @@ shared_mutex::lock_shared()
|
||||
}
|
||||
|
||||
bool
|
||||
shared_mutex::try_lock_shared()
|
||||
shared_timed_mutex::try_lock_shared()
|
||||
{
|
||||
unique_lock<mutex> lk(__mut_);
|
||||
unsigned num_readers = __state_ & __n_readers_;
|
||||
@@ -79,7 +79,7 @@ shared_mutex::try_lock_shared()
|
||||
}
|
||||
|
||||
void
|
||||
shared_mutex::unlock_shared()
|
||||
shared_timed_mutex::unlock_shared()
|
||||
{
|
||||
lock_guard<mutex> _(__mut_);
|
||||
unsigned num_readers = (__state_ & __n_readers_) - 1;
|
||||
|
Reference in New Issue
Block a user