Fix SIOF in folly/io/async/Request.cpp
authorAndrii Grynenko <andrii@fb.com>
Tue, 23 Feb 2016 22:56:29 +0000 (14:56 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Tue, 23 Feb 2016 23:20:25 +0000 (15:20 -0800)
Summary: Use Meyers singleton instead.

Reviewed By: afrind

Differential Revision: D2963282

fb-gh-sync-id: 7aec36e7cc3b0ab09b2b093202f40d5b0d399f4d
shipit-source-id: 7aec36e7cc3b0ab09b2b093202f40d5b0d399f4d

folly/io/async/Request.cpp

index 7a048a35e4ef2f94c5649252d4b75d9fe2048ce2..d2d17ca7d83cd344c8821ee4411ab9685dc3e5a5 100644 (file)
 
 namespace folly {
 
-namespace {
-
-using SingletonT = SingletonThreadLocal<std::shared_ptr<RequestContext>>;
-SingletonT singleton;
-}
-
 std::shared_ptr<RequestContext>& RequestContext::getStaticContext() {
+  using SingletonT = SingletonThreadLocal<std::shared_ptr<RequestContext>>;
+  static SingletonT singleton;
+
   return singleton.get();
 }
 }