Commit f864dfd9 authored by Marian Triebe's avatar Marian Triebe

Remove `thread_local` on OSX

GCC can compile code which use `thread_local` on OSX, but generates
faulty code. The generated code leads to a heap-use-after-free.
parent b75c0a6d
...@@ -43,7 +43,7 @@ using cache_map = std::map<const std::type_info*, std::unique_ptr<memory_cache>> ...@@ -43,7 +43,7 @@ using cache_map = std::map<const std::type_info*, std::unique_ptr<memory_cache>>
} // namespace <anonymous> } // namespace <anonymous>
#ifdef CAF_CLANG #if defined(CAF_CLANG) || defined(CAF_MACOS)
namespace { namespace {
pthread_key_t s_key; pthread_key_t s_key;
...@@ -72,13 +72,13 @@ cache_map& get_cache_map() { ...@@ -72,13 +72,13 @@ cache_map& get_cache_map() {
return *cache; return *cache;
} }
#else // !CAF_CLANG #else // !CAF_CLANG && !CAF_MACOS
namespace { namespace {
thread_local std::unique_ptr<cache_map> s_key; thread_local std::unique_ptr<cache_map> s_key;
} } // namespace <anonymous>
cache_map& get_cache_map() { cache_map& get_cache_map() {
if (! s_key) { if (! s_key) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment