Commit 201b0af5 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Fix StaticSingletonManagerSansRaii cache

Summary: [Folly] Fix `StaticSingletonManagerSansRaii` cache.

Reviewed By: aary

Differential Revision: D14928194

fbshipit-source-id: 6800c96ff40ec35e18a06b9c6a9f150a50695e37
parent 24af36b0
...@@ -33,7 +33,7 @@ class StaticSingletonManagerSansRtti { ...@@ -33,7 +33,7 @@ class StaticSingletonManagerSansRtti {
public: public:
template <typename T, typename Tag> template <typename T, typename Tag>
FOLLY_EXPORT FOLLY_ALWAYS_INLINE static T& create() { FOLLY_EXPORT FOLLY_ALWAYS_INLINE static T& create() {
std::atomic<T*> cache{}; static std::atomic<T*> cache{};
auto const pointer = cache.load(std::memory_order_acquire); auto const pointer = cache.load(std::memory_order_acquire);
return FOLLY_LIKELY(!!pointer) ? *pointer : create_<T, Tag>(cache); return FOLLY_LIKELY(!!pointer) ? *pointer : create_<T, Tag>(cache);
} }
......
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