Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7abf86ba authored by Ady Abraham's avatar Ady Abraham Committed by android-build-merger
Browse files

Merge "FenceTimeline: Fix a potential race condition" into qt-dev am: df23713d

am: cd5a3c44

Change-Id: I4690e7cd10cd272574b0820e2e12707c7b2dee72
parents af0689d6 cd5a3c44
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -279,8 +279,8 @@ void FenceTimeline::push(const std::shared_ptr<FenceTime>& fence) {
}

void FenceTimeline::updateSignalTimes() {
    while (!mQueue.empty()) {
    std::lock_guard<std::mutex> lock(mMutex);
    while (!mQueue.empty()) {
        std::shared_ptr<FenceTime> fence = mQueue.front().lock();
        if (!fence) {
            // The shared_ptr no longer exists and no one cares about the
+2 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@

#include <ui/Fence.h>
#include <utils/Flattenable.h>
#include <utils/Mutex.h>
#include <utils/Timers.h>

#include <atomic>
@@ -159,7 +160,7 @@ public:

private:
    mutable std::mutex mMutex;
    std::queue<std::weak_ptr<FenceTime>> mQueue;
    std::queue<std::weak_ptr<FenceTime>> mQueue GUARDED_BY(mMutex);
};

// Used by test code to create or get FenceTimes for a given Fence.