ReadMostlyAtomicObserver and minor cleanup
Summary: `folly::observer::ReadMostlyAtomicObserver` docblock explains it well: ``` /** * A ReadMostlyAtomicObserver guarantees that reading is exactly one relaxed * atomic load. Like AtomicObserver, the value is cached using `std::atomic`. * However, there is no version check when reading which means that the * cached value may be out-of-date with the Observer value. The cached value * will be updated asynchronously in a background thread. * * Because there is no version check when reading, ReadMostlyAtomicObserver * does not capture observer dependencies when used from makeObserver. It is not * possible to create a dependent observer. Therefore, ReadMostlyAtomicObserver * models none of CopyConstructible, MoveConstructible, CopyAssignable, or * MoveAssignable. Dependent observers should be created using the underlying * observer. * * ReadMostlyAtomicObserver is ideal for fastest possible reads on a * trivially-copyable type when a slightly out-of-date value will suffice. It is * perfect for very frequent reads coupled with very infrequent writes. */ ``` Other minor changes: * Added `getUnderlyingObserver` to each of the special-purpose observers. * Sprinkled `std::move` where neccessary. Reviewed By: yfeldblum Differential Revision: D27381490 fbshipit-source-id: fed039ae481af0c4e4148f80df03e30a125e333f
Showing
Please register or sign in to comment