X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2Fio%2Fasync%2FRequest.cpp;h=f8cca8b92a866c53bf34253fbf6ea96343208425;hp=644c208f18765c88453b55800d68732f761b469f;hb=cf930032da9b0796d96c14c3b4446a75477c1ef3;hpb=8893b8bcd26b41471e77c6882d77404c9a617176 diff --git a/folly/io/async/Request.cpp b/folly/io/async/Request.cpp index 644c208f..f8cca8b9 100644 --- a/folly/io/async/Request.cpp +++ b/folly/io/async/Request.cpp @@ -141,16 +141,10 @@ std::shared_ptr RequestContext::setContext( } std::shared_ptr& RequestContext::getStaticContext() { - using T = std::shared_ptr; -#ifdef FOLLY_TLS - alignas(alignof(T)) static FOLLY_TLS unsigned char storage[sizeof(T)]; - static FOLLY_TLS T* singleton; - return singleton ? *singleton : *(singleton = new (storage) T()); -#else - struct PrivateTag {}; - static SingletonThreadLocal singleton; + using SingletonT = SingletonThreadLocal>; + static SingletonT singleton; + return singleton.get(); -#endif } RequestContext* RequestContext::get() {