From 0f20ec761ef24191094bb7b575ba3637f422a1e5 Mon Sep 17 00:00:00 2001 From: Stephen Webb Date: Thu, 23 Nov 2023 10:40:38 +1100 Subject: [PATCH] MDC and NDC availablity no longer depend on APR thread support (#299) --- src/main/cpp/threadspecificdata.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/cpp/threadspecificdata.cpp b/src/main/cpp/threadspecificdata.cpp index 8ae1ec546..105db6646 100644 --- a/src/main/cpp/threadspecificdata.cpp +++ b/src/main/cpp/threadspecificdata.cpp @@ -64,6 +64,9 @@ ThreadSpecificData* ThreadSpecificData::getCurrentData() void* pData = NULL; apr_threadkey_private_get(&pData, APRInitializer::getTlsKey()); return (ThreadSpecificData*) pData; +#elif LOG4CXX_HAS_THREAD_LOCAL + thread_local ThreadSpecificData data; + return &data; #else return &getDataNoThreads(); #endif @@ -167,6 +170,8 @@ ThreadSpecificData* ThreadSpecificData::createCurrentData() } return newData; +#elif LOG4CXX_HAS_THREAD_LOCAL + return getCurrentData(); #else return 0; #endif