typename = typename std::enable_if<
LockTraits<typename SyncType::MutexType>::is_upgrade>::type>
LockedPtr<SynchronizedType, LockPolicyFromUpgradeToShared>
- moveFromUpgradeToShared() {
+ moveFromUpgradeToRead() {
auto* parent_to_pass_on = this->parent_;
this->parent_ = nullptr;
return LockedPtr<SynchronizedType, LockPolicyFromUpgradeToShared>(
typename = typename std::enable_if<
LockTraits<typename SyncType::MutexType>::is_upgrade>::type>
LockedPtr<SynchronizedType, LockPolicyFromExclusiveToShared>
- moveFromWriteToShared() {
+ moveFromWriteToRead() {
auto* parent_to_pass_on = this->parent_;
this->parent_ = nullptr;
return LockedPtr<SynchronizedType, LockPolicyFromExclusiveToShared>(
* `moveFromUpgradeToWrite()`
* `moveFromWriteToUpgrade()`
-* `moveFromWriteToShared()`
-* `moveFromUpgradeToShared()`
+* `moveFromWriteToRead()`
+* `moveFromUpgradeToRead()`
Calling these leaves the `LockedPtr` object on which the method was called in
an invalid `null` state and returns another LockedPtr proxy holding the
// ulock is now null
wlock->updateObj();
- // release write lock and acquire shared lock atomically
- auto rlock = wlock.moveFromWriteToShared();
+ // release write lock and acquire read lock atomically
+ auto rlock = wlock.moveFromWriteToRead();
// wlock is now null
return rlock->newSize();
} else {
- // release upgrade lock and acquire shared lock atomically
- auto rlock = ulock.moveFromUpgradeToShared();
+ // release upgrade lock and acquire read lock atomically
+ auto rlock = ulock.moveFromUpgradeToRead();
// ulock is now null
return rlock->newSize();
}
// test going from upgrade to shared
{
auto ulock = sync.ulock();
- auto slock = ulock.moveFromUpgradeToShared();
+ auto slock = ulock.moveFromUpgradeToRead();
EXPECT_EQ(static_cast<bool>(ulock), false);
EXPECT_EQ(
globalAllPowerfulAssertingMutex.lock_state,
// test going from exclusive to shared
{
auto wlock = sync.wlock();
- auto slock = wlock.moveFromWriteToShared();
+ auto slock = wlock.moveFromWriteToRead();
EXPECT_EQ(static_cast<bool>(wlock), false);
EXPECT_EQ(
globalAllPowerfulAssertingMutex.lock_state,
globalAllPowerfulAssertingMutex.lock_state,
FakeAllPowerfulAssertingMutexInternal::CurrentLockState::UPGRADE);
- auto slock = ulock.moveFromUpgradeToShared();
+ auto slock = ulock.moveFromUpgradeToRead();
EXPECT_EQ(static_cast<bool>(ulock), false);
EXPECT_EQ(
globalAllPowerfulAssertingMutex.lock_state,
globalAllPowerfulAssertingMutex.lock_state,
FakeAllPowerfulAssertingMutexInternal::CurrentLockState::UNIQUE);
- auto slock = wlock.moveFromWriteToShared();
+ auto slock = wlock.moveFromWriteToRead();
EXPECT_EQ(static_cast<bool>(wlock), false);
EXPECT_EQ(
globalAllPowerfulAssertingMutex.lock_state,