X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/93a3786624b2768d89bfa27e46598dc64e2fb70a..2656c66b5b30d5597e842a751c7f19ad6c2fe31a:/heap/GCThread.cpp diff --git a/heap/GCThread.cpp b/heap/GCThread.cpp index aa868f1..cf496a1 100644 --- a/heap/GCThread.cpp +++ b/heap/GCThread.cpp @@ -29,6 +29,7 @@ #include "CopyVisitor.h" #include "CopyVisitorInlines.h" #include "GCThreadSharedData.h" +#include "JSCInlines.h" #include "SlotVisitor.h" #include #include @@ -69,16 +70,14 @@ CopyVisitor* GCThread::copyVisitor() GCPhase GCThread::waitForNextPhase() { - MutexLocker locker(m_shared.m_phaseLock); - while (m_shared.m_gcThreadsShouldWait) - m_shared.m_phaseCondition.wait(m_shared.m_phaseLock); + std::unique_lock lock(m_shared.m_phaseMutex); + m_shared.m_phaseConditionVariable.wait(lock, [this] { return !m_shared.m_gcThreadsShouldWait; }); m_shared.m_numberOfActiveGCThreads--; if (!m_shared.m_numberOfActiveGCThreads) - m_shared.m_activityCondition.signal(); + m_shared.m_activityConditionVariable.notify_one(); - while (m_shared.m_currentPhase == NoPhase) - m_shared.m_phaseCondition.wait(m_shared.m_phaseLock); + m_shared.m_phaseConditionVariable.wait(lock, [this] { return m_shared.m_currentPhase != NoPhase; }); m_shared.m_numberOfActiveGCThreads++; return m_shared.m_currentPhase; } @@ -92,7 +91,7 @@ void GCThread::gcThreadMain() // Wait for the main thread to finish creating and initializing us. The main thread grabs this lock before // creating this thread. We aren't guaranteed to have a valid threadID until the main thread releases this lock. { - MutexLocker locker(m_shared.m_phaseLock); + std::lock_guard lock(m_shared.m_phaseMutex); } { ParallelModeEnabler enabler(*m_slotVisitor);