diff --git a/include/chaiscript/chaiscript_threading.hpp b/include/chaiscript/chaiscript_threading.hpp index cb5e129..01bda2b 100644 --- a/include/chaiscript/chaiscript_threading.hpp +++ b/include/chaiscript/chaiscript_threading.hpp @@ -67,44 +67,44 @@ namespace chaiscript class Thread_Storage { public: - - explicit Thread_Storage(void *t_key) - : m_key(t_key) - { - } + Thread_Storage() = default; + Thread_Storage(const Thread_Storage &) = delete; + Thread_Storage(Thread_Storage &&) = delete; + Thread_Storage &operator=(const Thread_Storage &) = delete; + Thread_Storage &operator=(Thread_Storage &&) = delete; ~Thread_Storage() { - t().erase(m_key); + t().erase(this); } inline const T *operator->() const { - return &(t()[m_key]); + return &(t()[this]); } inline const T &operator*() const { - return t()[m_key]; + return t()[this]; } inline T *operator->() { - return &(t()[m_key]); + return &(t()[this]); } inline T &operator*() { - return t()[m_key]; + return t()[this]; } void *m_key; private: - static std::unordered_map &t() + static std::unordered_map &t() { - thread_local static std::unordered_map my_t; + thread_local std::unordered_map my_t; return my_t; } }; diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index c4e6198..d8bfb25 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -452,7 +452,7 @@ namespace chaiscript }; explicit Dispatch_Engine(chaiscript::parser::ChaiScript_Parser_Base &parser) - : m_stack_holder(this), + : m_stack_holder(), m_parser(parser) { } diff --git a/include/chaiscript/dispatchkit/type_conversions.hpp b/include/chaiscript/dispatchkit/type_conversions.hpp index e16693a..d9d2f37 100644 --- a/include/chaiscript/dispatchkit/type_conversions.hpp +++ b/include/chaiscript/dispatchkit/type_conversions.hpp @@ -338,9 +338,7 @@ namespace chaiscript : m_mutex(), m_conversions(), m_convertableTypes(), - m_num_types(0), - m_thread_cache(this), - m_conversion_saves(this) + m_num_types(0) { }