From 5683216e26195ea43b29bfd703186d9345906a73 Mon Sep 17 00:00:00 2001 From: ThePhD Date: Sat, 12 Aug 2017 09:42:44 -0400 Subject: [PATCH] thread_local weee --- single/sol/sol.hpp | 30 +++++++++++++++--------------- sol/stack_get.hpp | 12 ++++++------ sol/stack_push.hpp | 14 +++++++------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/single/sol/sol.hpp b/single/sol/sol.hpp index 68e41999..01a0f454 100644 --- a/single/sol/sol.hpp +++ b/single/sol/sol.hpp @@ -20,8 +20,8 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // This file was generated with a script. -// Generated 2017-08-12 02:25:46.299991 UTC -// This header was generated with sol v2.18.0 (revision 2486d6a) +// Generated 2017-08-12 13:41:38.924501 UTC +// This header was generated with sol v2.18.0 (revision 180ba56) // https://github.com/ThePhD/sol2 #ifndef SOL_SINGLE_INCLUDE_HPP @@ -6727,7 +6727,7 @@ namespace sol { if (len < 1) return std::wstring(); if (sizeof(wchar_t) == 2) { - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::wstring r = convert.from_bytes(str, str + len); #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 7 // Fuck you, MinGW, and fuck you libstdc++ for introducing this absolutely asinine bug @@ -6740,7 +6740,7 @@ namespace sol { #endif return r; } - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::wstring r = convert.from_bytes(str, str + len); return r; } @@ -6755,12 +6755,12 @@ namespace sol { if (len < 1) return std::u16string(); #ifdef _MSC_VER - static std::wstring_convert, int16_t> convert; + thread_local std::wstring_convert, int16_t> convert; auto intd = convert.from_bytes(str, str + len); std::u16string r(intd.size(), '\0'); std::memcpy(&r[0], intd.data(), intd.size() * sizeof(char16_t)); #else - static std::wstring_convert, char16_t> convert; + thread_local std::wstring_convert, char16_t> convert; std::u16string r = convert.from_bytes(str, str + len); #endif // VC++ is a shit return r; @@ -6776,12 +6776,12 @@ namespace sol { if (len < 1) return std::u32string(); #ifdef _MSC_VER - static std::wstring_convert, int32_t> convert; + thread_local std::wstring_convert, int32_t> convert; auto intd = convert.from_bytes(str, str + len); std::u32string r(intd.size(), '\0'); std::memcpy(&r[0], intd.data(), r.size() * sizeof(char32_t)); #else - static std::wstring_convert, char32_t> convert; + thread_local std::wstring_convert, char32_t> convert; std::u32string r = convert.from_bytes(str, str + len); #endif // VC++ is a shit return r; @@ -7339,7 +7339,7 @@ namespace sol { #include #include #ifdef SOL_CODECVT_SUPPORT -#endif +#endif // codecvt support #ifdef SOL_CXX17_FEATURES #endif // C++17 @@ -7878,11 +7878,11 @@ namespace sol { static int push(lua_State* L, const wchar_t* strb, const wchar_t* stre) { if (sizeof(wchar_t) == 2) { - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::string u8str = convert.to_bytes(strb, stre); return stack::push(L, u8str); } - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::string u8str = convert.to_bytes(strb, stre); return stack::push(L, u8str); } @@ -7900,10 +7900,10 @@ namespace sol { static int push(lua_State* L, const char16_t* strb, const char16_t* stre) { #ifdef _MSC_VER - static std::wstring_convert, int16_t> convert; + thread_local std::wstring_convert, int16_t> convert; std::string u8str = convert.to_bytes(reinterpret_cast(strb), reinterpret_cast(stre)); #else - static std::wstring_convert, char16_t> convert; + thread_local std::wstring_convert, char16_t> convert; std::string u8str = convert.to_bytes(strb, stre); #endif // VC++ is a shit return stack::push(L, u8str); @@ -7922,10 +7922,10 @@ namespace sol { static int push(lua_State* L, const char32_t* strb, const char32_t* stre) { #ifdef _MSC_VER - static std::wstring_convert, int32_t> convert; + thread_local std::wstring_convert, int32_t> convert; std::string u8str = convert.to_bytes(reinterpret_cast(strb), reinterpret_cast(stre)); #else - static std::wstring_convert, char32_t> convert; + thread_local std::wstring_convert, char32_t> convert; std::string u8str = convert.to_bytes(strb, stre); #endif // VC++ is a shit return stack::push(L, u8str); diff --git a/sol/stack_get.hpp b/sol/stack_get.hpp index 682afd5e..3861c323 100644 --- a/sol/stack_get.hpp +++ b/sol/stack_get.hpp @@ -432,7 +432,7 @@ namespace sol { if (len < 1) return std::wstring(); if (sizeof(wchar_t) == 2) { - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::wstring r = convert.from_bytes(str, str + len); #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 7 // Fuck you, MinGW, and fuck you libstdc++ for introducing this absolutely asinine bug @@ -445,7 +445,7 @@ namespace sol { #endif return r; } - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::wstring r = convert.from_bytes(str, str + len); return r; } @@ -460,12 +460,12 @@ namespace sol { if (len < 1) return std::u16string(); #ifdef _MSC_VER - static std::wstring_convert, int16_t> convert; + thread_local std::wstring_convert, int16_t> convert; auto intd = convert.from_bytes(str, str + len); std::u16string r(intd.size(), '\0'); std::memcpy(&r[0], intd.data(), intd.size() * sizeof(char16_t)); #else - static std::wstring_convert, char16_t> convert; + thread_local std::wstring_convert, char16_t> convert; std::u16string r = convert.from_bytes(str, str + len); #endif // VC++ is a shit return r; @@ -481,12 +481,12 @@ namespace sol { if (len < 1) return std::u32string(); #ifdef _MSC_VER - static std::wstring_convert, int32_t> convert; + thread_local std::wstring_convert, int32_t> convert; auto intd = convert.from_bytes(str, str + len); std::u32string r(intd.size(), '\0'); std::memcpy(&r[0], intd.data(), r.size() * sizeof(char32_t)); #else - static std::wstring_convert, char32_t> convert; + thread_local std::wstring_convert, char32_t> convert; std::u32string r = convert.from_bytes(str, str + len); #endif // VC++ is a shit return r; diff --git a/sol/stack_push.hpp b/sol/stack_push.hpp index 672f76a6..acec6498 100644 --- a/sol/stack_push.hpp +++ b/sol/stack_push.hpp @@ -33,7 +33,7 @@ #ifdef SOL_CODECVT_SUPPORT #include #include -#endif +#endif // codecvt support #ifdef SOL_CXX17_FEATURES #include #include @@ -574,11 +574,11 @@ namespace sol { static int push(lua_State* L, const wchar_t* strb, const wchar_t* stre) { if (sizeof(wchar_t) == 2) { - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::string u8str = convert.to_bytes(strb, stre); return stack::push(L, u8str); } - static std::wstring_convert> convert; + thread_local std::wstring_convert> convert; std::string u8str = convert.to_bytes(strb, stre); return stack::push(L, u8str); } @@ -596,10 +596,10 @@ namespace sol { static int push(lua_State* L, const char16_t* strb, const char16_t* stre) { #ifdef _MSC_VER - static std::wstring_convert, int16_t> convert; + thread_local std::wstring_convert, int16_t> convert; std::string u8str = convert.to_bytes(reinterpret_cast(strb), reinterpret_cast(stre)); #else - static std::wstring_convert, char16_t> convert; + thread_local std::wstring_convert, char16_t> convert; std::string u8str = convert.to_bytes(strb, stre); #endif // VC++ is a shit return stack::push(L, u8str); @@ -618,10 +618,10 @@ namespace sol { static int push(lua_State* L, const char32_t* strb, const char32_t* stre) { #ifdef _MSC_VER - static std::wstring_convert, int32_t> convert; + thread_local std::wstring_convert, int32_t> convert; std::string u8str = convert.to_bytes(reinterpret_cast(strb), reinterpret_cast(stre)); #else - static std::wstring_convert, char32_t> convert; + thread_local std::wstring_convert, char32_t> convert; std::string u8str = convert.to_bytes(strb, stre); #endif // VC++ is a shit return stack::push(L, u8str);