Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate fields of type folly::SharedMutex to be marked as mutable in …
…fbcode (assorted) Summary: The nested-name lock-holder `folly::SharedMutex::ReadHolder` accepts `folly::SharedMutex const&`, i.e., as ref-to-const, and it internally does a `const_cast` to remove the `const`. This internal `const_cast` is necessary because members `folly::SharedMutex::lock_shared` and related member functions are not `const`-qualified. This lock-holder interface is a convenience since a shared-lock on a shared-mutex instance are commonly acquired in `const`-qualified class member functions, where the shared-mutex instance is a class data member and access to it from a `const`-qualified member function implicitly has only `const`-access to the shared-mutex instance. But `std::shared_lock` does not have this convenience. It is the canonical lock-holder for shared locks and we wish to migrate all uses of `folly::SharedMutex::ReadHolder` to `std::shared_lock`. So we must mark relevant shared-mutex instances with `mutable`. As a small shortcut, we search for and mark all class data members of type `folly::SharedMutex` as `mutable`. Reviewed By: luciang Differential Revision: D52921022 fbshipit-source-id: bca727c89d153cee583b2862fdf70fdd4e22ff05
- Loading branch information