diff options
| author | Apollon Oikonomopoulos <apoikos@debian.org> | 2018-03-22 12:08:05 +0200 |
|---|---|---|
| committer | Apollon Oikonomopoulos <apoikos@debian.org> | 2018-03-22 12:08:05 +0200 |
| commit | 72ad42c506a506ef238d4b1fdcf2b9da5668bfb9 (patch) | |
| tree | df94bdab3d6f16e14016f4547b9e86f368ba8150 /src/mongo/scripting/mozjs/PosixNSPR.cpp | |
| parent | 648fcfa3cf11ba8fdb7bb64c52f3159b4351ae3c (diff) | |
| parent | c49e99631589113663b1a3ac691870421965a315 (diff) | |
Update upstream source from tag 'upstream/3.4.14'
Update to upstream version '3.4.14'
with Debian dir 8c079cd0bdbb1831aa5b89a3b7d4c1b4a1b891a2
Diffstat (limited to 'src/mongo/scripting/mozjs/PosixNSPR.cpp')
| -rw-r--r-- | src/mongo/scripting/mozjs/PosixNSPR.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/mongo/scripting/mozjs/PosixNSPR.cpp b/src/mongo/scripting/mozjs/PosixNSPR.cpp index ed1a3d5a49d..9054e930443 100644 --- a/src/mongo/scripting/mozjs/PosixNSPR.cpp +++ b/src/mongo/scripting/mozjs/PosixNSPR.cpp @@ -24,6 +24,7 @@ #include "mongo/stdx/chrono.h" #include "mongo/stdx/condition_variable.h" +#include "mongo/stdx/memory.h" #include "mongo/stdx/mutex.h" #include "mongo/stdx/thread.h" #include "mongo/util/concurrency/thread_name.h" @@ -98,9 +99,13 @@ PRThread* PR_CreateThread(PRThreadType type, MOZ_ASSERT(priority == PR_PRIORITY_NORMAL); try { - std::unique_ptr<nspr::Thread, void (*)(nspr::Thread*)> t( - js_new<nspr::Thread>(start, arg, state != PR_UNJOINABLE_THREAD), - js_delete_nonconst<nspr::Thread>); + // We can't use the nspr allocator to allocate this thread, because under asan we + // instrument the allocator so that asan can track the pointers correctly. This + // instrumentation + // requires that pointers be deleted in the same thread that they were allocated in. + // The threads created in PR_CreateThread are not always freed in the same thread + // that they were created in. So, we use the standard allocator here. + auto t = mongo::stdx::make_unique<nspr::Thread>(start, arg, state != PR_UNJOINABLE_THREAD); t->thread() = mongo::stdx::thread(&nspr::Thread::ThreadRoutine, t.get()); @@ -118,7 +123,7 @@ PRStatus PR_JoinThread(PRThread* thread) { try { thread->thread().join(); - js_delete(thread); + delete thread; return PR_SUCCESS; } catch (...) { |
