Commit b65ef9f8 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook GitHub Bot

cut legacy LockedPtr::getUniqueLock

Summary: Now that `LockedPtr::as_lock` is always available regardless of mutex type and regardless of lock category, `getUniqueLock` is no longer needed.

Differential Revision: D28987941

fbshipit-source-id: a6894cffb30d280ec8325c14784592b2d4381f4c
parent 07ab2e2b
......@@ -341,7 +341,7 @@ class SynchronizedBase<Subclass, detail::MutexLevel::UPGRADE>
* This is similar to withULock(), but the function will be passed a
* LockedPtr rather than a reference to the data itself.
*
* This allows scopedUnlock() and getUniqueLock() to be called on the
* This allows scopedUnlock() and as_lock() to be called on the
* LockedPtr argument.
*
* This also allows you to upgrade the LockedPtr proxy to a write state so
......@@ -447,7 +447,7 @@ class SynchronizedBase<Subclass, detail::MutexLevel::UNIQUE> {
* This is similar to withWLock(), but the function will be passed a
* LockedPtr rather than a reference to the data itself.
*
* This allows scopedUnlock() and getUniqueLock() to be called on the
* This allows scopedUnlock() and as_lock() to be called on the
* LockedPtr argument.
*/
template <class Function>
......@@ -1158,24 +1158,6 @@ class LockedPtr {
LockType& as_lock() noexcept { return lock_; }
LockType const& as_lock() const noexcept { return lock_; }
/**
* Deprecated. For backward compatibility. Use as_lock() instead.
*/
template <
typename M = MutexType,
std::enable_if_t<std::is_same<M, std::mutex>::value, int> = 0>
LockType& getUniqueLock() noexcept {
static_assert(std::is_same<M, MutexType>::value, "mismatch");
return as_lock();
}
template <
typename M = MutexType,
std::enable_if_t<std::is_same<M, std::mutex>::value, int> = 0>
LockType const& getUniqueLock() const noexcept {
static_assert(std::is_same<M, MutexType>::value, "mismatch");
return as_lock();
}
/**
* Check if this LockedPtr is uninitialized, or points to valid locked data.
*
......
......@@ -654,7 +654,7 @@ When used with a `std::mutex`, `Synchronized` supports using a
in the internal data.
The `LockedPtr` returned by `Synchronized<T, std::mutex>::lock()` has a
`getUniqueLock()` method that returns a reference to a
`as_lock()` method that returns a reference to a
`std::unique_lock<std::mutex>`, which can be given to the
`std::condition_variable`:
......@@ -665,7 +665,7 @@ The `LockedPtr` returned by `Synchronized<T, std::mutex>::lock()` has a
// Assuming some other thread will put data on vec and signal
// emptySignal, we can then wait on it as follows:
auto locked = vec.lock();
emptySignal.wait(locked.getUniqueLock(),
emptySignal.wait(locked.as_lock(),
[&] { return !locked->empty(); });
```
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment