mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 01:06:45 +08:00
update tls
This commit is contained in:
parent
ca6815c601
commit
5784b29521
@ -61,9 +61,9 @@ public:
|
|||||||
|
|
||||||
template <typename... P>
|
template <typename... P>
|
||||||
T* create(P&&... params) {
|
T* create(P&&... params) {
|
||||||
auto ptr = static_cast<T*>(*this);
|
thread_local auto ptr = static_cast<T*>(*this);
|
||||||
if (ptr == nullptr) {
|
if (ptr == nullptr) {
|
||||||
return (*this) = new T(std::forward<P>(params)...);
|
return ptr = (*this) = new T(std::forward<P>(params)...);
|
||||||
}
|
}
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user