diff options
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/mozjs/PosixNSPR.cpp | 10 | ||||
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.cpp | 6 | ||||
-rw-r--r-- | src/mongo/scripting/mozjs/jscustomallocator.cpp | 5 |
3 files changed, 9 insertions, 12 deletions
diff --git a/src/mongo/scripting/mozjs/PosixNSPR.cpp b/src/mongo/scripting/mozjs/PosixNSPR.cpp index ed1a3d5a49d..3469d35038d 100644 --- a/src/mongo/scripting/mozjs/PosixNSPR.cpp +++ b/src/mongo/scripting/mozjs/PosixNSPR.cpp @@ -27,7 +27,6 @@ #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_name.h" -#include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/time_support.h" class nspr::Thread { @@ -48,7 +47,7 @@ public: }; namespace { -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL nspr::Thread* kCurrentThread; +thread_local nspr::Thread* kCurrentThread = nullptr; } // namespace void* nspr::Thread::ThreadRoutine(void* arg) { @@ -136,10 +135,11 @@ PRStatus PR_SetCurrentThreadName(const char* name) { return PR_SUCCESS; } -static const size_t MaxTLSKeyCount = 32; -static size_t gTLSKeyCount; namespace { -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL std::array<void*, MaxTLSKeyCount> gTLSArray; + +const size_t MaxTLSKeyCount = 32; +size_t gTLSKeyCount; +thread_local std::array<void*, MaxTLSKeyCount> gTLSArray; } // namespace diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index a6b42649d35..4853dfdea47 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -46,7 +46,6 @@ #include "mongo/scripting/mozjs/valuewriter.h" #include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" -#include "mongo/util/concurrency/threadlocal.h" #include "mongo/util/log.h" #include "mongo/util/scopeguard.h" @@ -100,9 +99,8 @@ bool closeToMaxMemory() { } } // namespace -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL MozJSImplScope::ASANHandles* kCurrentASANHandles = - nullptr; -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL MozJSImplScope* kCurrentScope = nullptr; +thread_local MozJSImplScope::ASANHandles* kCurrentASANHandles = nullptr; +thread_local MozJSImplScope* kCurrentScope = nullptr; struct MozJSImplScope::MozJSEntry { MozJSEntry(MozJSImplScope* scope) diff --git a/src/mongo/scripting/mozjs/jscustomallocator.cpp b/src/mongo/scripting/mozjs/jscustomallocator.cpp index 00f5f404fc4..aab9260a9ba 100644 --- a/src/mongo/scripting/mozjs/jscustomallocator.cpp +++ b/src/mongo/scripting/mozjs/jscustomallocator.cpp @@ -34,7 +34,6 @@ #include "mongo/config.h" #include "mongo/scripting/mozjs/implscope.h" -#include "mongo/util/concurrency/threadlocal.h" #ifdef __linux__ #include <malloc.h> @@ -72,8 +71,8 @@ namespace { * maximum number of bytes we will consider handing out. They are set by * MozJSImplScope on start up. */ -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL size_t total_bytes; -MONGO_TRIVIALLY_CONSTRUCTIBLE_THREAD_LOCAL size_t max_bytes; +thread_local size_t total_bytes = 0; +thread_local size_t max_bytes = 0; /** * When we don't have malloc_usable_size, we manage by adjusting our pointer by |