Skip to content

Commit 1cda459

Browse files
Updated mutex code
1 parent a78cdbc commit 1cda459

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

PresentData/PresentMonTraceConsumer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,8 +1920,7 @@ void PMTraceConsumer::AddPresentToCompletedList(std::shared_ptr<PresentEvent> co
19201920
UpdateReadyCount(present);
19211921

19221922
{
1923-
std::lock_guard<std::mutex> lock(mPresentEventMutex);
1924-
1923+
std::unique_lock<std::mutex> lock(mPresentEventMutex);
19251924
// It's possible for a deferred condition to never be cleared. e.g., a process' last present
19261925
// doesn't get a Present_Stop event. When this happens the deferred present will prevent all
19271926
// subsequent presents from other processes from being dequeued until the ring buffer wraps and
@@ -1935,6 +1934,8 @@ void PMTraceConsumer::AddPresentToCompletedList(std::shared_ptr<PresentEvent> co
19351934
deferredPresent->IsLost = true;
19361935
deferredPresent->WaitingForPresentStop = false;
19371936
deferredPresent->WaitingForFlipFrameType = false;
1937+
// UpdateReadyCount also locks the mPresentEventMutex so unlock here
1938+
lock.unlock();
19381939
UpdateReadyCount(deferredPresent);
19391940
}
19401941
}

0 commit comments

Comments
 (0)