update tls

This commit is contained in:
mutouyun 2019-04-01 23:00:00 +08:00
parent ca6815c601
commit 5784b29521

View File

@ -61,9 +61,9 @@ public:
template <typename... P>
T* create(P&&... params) {
auto ptr = static_cast<T*>(*this);
thread_local auto ptr = static_cast<T*>(*this);
if (ptr == nullptr) {
return (*this) = new T(std::forward<P>(params)...);
return ptr = (*this) = new T(std::forward<P>(params)...);
}
return ptr;
}