Add AtomicObserver<T>
Summary: An `AtomicObserver` is a read-optimized cache for an `Observer` value using `std::atomic`. This avoids creating a `shared_ptr` on every read (atomic increment/decrement on control block). The functionality is similar to that of `TLObserver` but uses significantly less memory if `std::atomic<T>` is valid. The read path involves 2 atomic loads and a cache staleness check. A lock is used when the cache needs to be updated. Reviewed By: zhxchen17 Differential Revision: D25254487 fbshipit-source-id: cfaf7c328c075f9f06c5c9d2d7bb2e1987285616
Showing
Please register or sign in to comment