diff --git a/include/tls_pointer.h b/include/tls_pointer.h index f07d3be..4e263f3 100644 --- a/include/tls_pointer.h +++ b/include/tls_pointer.h @@ -63,7 +63,7 @@ public: T* create(P&&... params) { auto ptr = static_cast(*this); if (ptr == nullptr) { - return (*this) = new T { std::forward

(params)... }; + return (*this) = new T(std::forward

(params)...); } return ptr; } diff --git a/src/memory/wrapper.hpp b/src/memory/wrapper.hpp index bd797f1..44f6b10 100644 --- a/src/memory/wrapper.hpp +++ b/src/memory/wrapper.hpp @@ -14,6 +14,7 @@ #include "def.h" #include "rw_lock.h" +#include "tls_pointer.h" namespace ipc { @@ -42,7 +43,7 @@ public: private: rw_lock lc_; - std::multimap> allocs_; + std::multimap allocs_; struct alloc_t { synchronized* t_; @@ -84,8 +85,8 @@ private: }; auto& alc_info() { - thread_local alloc_t alc { this }; - return alc; + static tls::pointer alc; + return *alc.create(this); } public: