Changeset 162352 in webkit for trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp
- Timestamp:
- Jan 20, 2014, 9:10:36 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/GCThreadSharedData.cpp
r162017 r162352 84 84 #if ENABLE(PARALLEL_GC) 85 85 // Grab the lock so the new GC threads can be properly initialized before they start running. 86 MutexLocker locker(m_phaseLock);86 std::unique_lock<std::mutex> lock(m_phaseMutex); 87 87 for (unsigned i = 1; i < Options::numberOfGCMarkers(); ++i) { 88 88 m_numberOfActiveGCThreads++; … … 96 96 97 97 // Wait for all the GCThreads to get to the right place. 98 while (m_numberOfActiveGCThreads) 99 m_activityCondition.wait(m_phaseLock); 98 m_activityConditionVariable.wait(lock, [this] { return !m_numberOfActiveGCThreads; }); 100 99 #endif 101 100 } … … 106 105 // Destroy our marking threads. 107 106 { 108 MutexLocker markingLocker(m_markingLock);109 MutexLocker phaseLocker(m_phaseLock);107 std::lock_guard<std::mutex> markingLock(m_markingMutex); 108 std::lock_guard<std::mutex> phaseLock(m_phaseMutex); 110 109 ASSERT(m_currentPhase == NoPhase); 111 110 m_parallelMarkersShouldExit = true; 112 111 m_gcThreadsShouldWait = false; 113 112 m_currentPhase = Exit; 114 m_phaseCondition .broadcast();113 m_phaseConditionVariable.notify_all(); 115 114 } 116 115 for (unsigned i = 0; i < m_gcThreads.size(); ++i) { … … 140 139 void GCThreadSharedData::startNextPhase(GCPhase phase) 141 140 { 142 MutexLocker phaseLocker(m_phaseLock);141 std::lock_guard<std::mutex> lock(m_phaseMutex); 143 142 ASSERT(!m_gcThreadsShouldWait); 144 143 ASSERT(m_currentPhase == NoPhase); 145 144 m_gcThreadsShouldWait = true; 146 145 m_currentPhase = phase; 147 m_phaseCondition .broadcast();146 m_phaseConditionVariable.notify_all(); 148 147 } 149 148 … … 151 150 { 152 151 ASSERT(m_gcThreadsShouldWait); 153 MutexLocker locker(m_phaseLock);152 std::unique_lock<std::mutex> lock(m_phaseMutex); 154 153 m_currentPhase = NoPhase; 155 154 m_gcThreadsShouldWait = false; 156 m_phaseCondition.broadcast(); 157 while (m_numberOfActiveGCThreads) 158 m_activityCondition.wait(m_phaseLock); 155 m_phaseConditionVariable.notify_all(); 156 m_activityConditionVariable.wait(lock, [this] { return !m_numberOfActiveGCThreads; }); 159 157 } 160 158 161 159 void GCThreadSharedData::didStartMarking() 162 160 { 163 MutexLocker markingLocker(m_markingLock);161 std::lock_guard<std::mutex> lock(m_markingMutex); 164 162 m_parallelMarkersShouldExit = false; 165 163 startNextPhase(Mark); … … 169 167 { 170 168 { 171 MutexLocker markingLocker(m_markingLock);169 std::lock_guard<std::mutex> lock(m_markingMutex); 172 170 m_parallelMarkersShouldExit = true; 173 m_markingCondition .broadcast();171 m_markingConditionVariable.notify_all(); 174 172 } 175 173
Note:
See TracChangeset
for help on using the changeset viewer.