diff --git a/folly/Synchronized.h b/folly/Synchronized.h index e21b57802d2..97e81ec0c2e 100644 --- a/folly/Synchronized.h +++ b/folly/Synchronized.h @@ -1004,6 +1004,28 @@ struct Synchronized : public SynchronizedBase< mutable Mutex mutex_; }; +/** + * Deprecated subclass of Synchronized that provides implicit locking + * via operator->. This is intended to ease migration while preventing + * accidental use of operator-> in new code. + */ +template +struct [[deprecated( + "use Synchronized and explicit lock(), wlock(), or rlock() instead")]] ImplicitSynchronized + : Synchronized { + private: + using Base = Synchronized; + + public: + using LockedPtr = typename Base::LockedPtr; + using ConstLockedPtr = typename Base::ConstLockedPtr; + using DataType = typename Base::DataType; + using MutexType = typename Base::MutexType; + + using Base::Base; + using Base::operator=; +}; + template class ScopedUnlocker;