Bug 956899 - Convert exclusive access lock from PRLock to Mutex; r=jandem

--HG--
extra : rebase_source : b13f0ea577d947e5192d16181ac14051490de741
This commit is contained in:
Terrence Cole 2016-03-02 10:43:34 -08:00
Родитель 015562d605
Коммит e54e391f05
3 изменённых файлов: 3 добавлений и 10 удалений

Просмотреть файл

@ -762,7 +762,7 @@ class MOZ_RAII AutoLockForExclusiveAccess
runtime = rt;
if (runtime->numExclusiveThreads) {
runtime->assertCanLock(ExclusiveAccessLock);
PR_Lock(runtime->exclusiveAccessLock);
runtime->exclusiveAccessLock.lock();
#ifdef DEBUG
runtime->exclusiveAccessOwner = PR_GetCurrentThread();
#endif
@ -789,7 +789,7 @@ class MOZ_RAII AutoLockForExclusiveAccess
MOZ_ASSERT(runtime->exclusiveAccessOwner == PR_GetCurrentThread());
runtime->exclusiveAccessOwner = nullptr;
#endif
PR_Unlock(runtime->exclusiveAccessLock);
runtime->exclusiveAccessLock.unlock();
} else {
MOZ_ASSERT(runtime->mainThreadHasExclusiveAccess);
#ifdef DEBUG

Просмотреть файл

@ -151,7 +151,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
handlingSegFault(false),
handlingJitInterrupt_(false),
interruptCallback(nullptr),
exclusiveAccessLock(nullptr),
#ifdef DEBUG
exclusiveAccessOwner(nullptr),
mainThreadHasExclusiveAccess(false),
@ -287,10 +286,6 @@ JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes)
ownerThreadNative_ = (size_t)pthread_self();
#endif
exclusiveAccessLock = PR_NewLock();
if (!exclusiveAccessLock)
return false;
if (!mainThread.init())
return false;
@ -428,8 +423,6 @@ JSRuntime::~JSRuntime()
finishSelfHosting();
MOZ_ASSERT(!exclusiveAccessOwner);
if (exclusiveAccessLock)
PR_DestroyLock(exclusiveAccessLock);
// Avoid bogus asserts during teardown.
MOZ_ASSERT(!numExclusiveThreads);

Просмотреть файл

@ -919,7 +919,7 @@ struct JSRuntime : public JS::shadow::Runtime,
* Locking this only occurs if there is actually a thread other than the
* main thread with an ExclusiveContext which could access such data.
*/
PRLock* exclusiveAccessLock;
js::Mutex exclusiveAccessLock;
#ifdef DEBUG
PRThread* exclusiveAccessOwner;
bool mainThreadHasExclusiveAccess;