From: Andrii Grynenko Date: Tue, 23 Feb 2016 22:56:29 +0000 (-0800) Subject: Fix SIOF in folly/io/async/Request.cpp X-Git-Tag: deprecate-dynamic-initializer~46 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=9c3e3be04ca23b73e4a9eecce8019e65f76cdf5d;p=folly.git Fix SIOF in folly/io/async/Request.cpp Summary: Use Meyers singleton instead. Reviewed By: afrind Differential Revision: D2963282 fb-gh-sync-id: 7aec36e7cc3b0ab09b2b093202f40d5b0d399f4d shipit-source-id: 7aec36e7cc3b0ab09b2b093202f40d5b0d399f4d --- diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index 7a048a35..d2d17ca7 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -22,13 +22,10 @@ namespace folly { -namespace { - -using SingletonT = SingletonThreadLocal>; -SingletonT singleton; -} - std::shared_ptr& RequestContext::getStaticContext() { + using SingletonT = SingletonThreadLocal>; + static SingletonT singleton; + return singleton.get(); } }