SF: Cleanups to use std::atomic/std::mutex
A few places in the code used "volatile". This patch removes the
volatile.
In most of the cases, the volatile value was converted to a std::atomic
value. The exception was Barrier where it was not actually necessary,
but there I converted the code to use std::mutex.
Bug: None
Test: atest SurfaceFlinger_test CtsViewTestCases
Change-Id: I7b4f5a7398a241db8201dc7f60d7c9cd41e32e1b
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index bfadf6e..a300857 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -794,7 +794,7 @@
// access must be protected by mStateLock
mutable Mutex mStateLock;
State mCurrentState{LayerVector::StateSet::Current};
- volatile int32_t mTransactionFlags;
+ std::atomic<int32_t> mTransactionFlags{0};
Condition mTransactionCV;
bool mTransactionPending;
bool mAnimTransactionPending;
@@ -813,8 +813,7 @@
bool mLayersRemoved;
bool mLayersAdded;
- // access must be protected by mInvalidateLock
- volatile int32_t mRepaintEverything;
+ std::atomic<bool> mRepaintEverything{false};
// helper methods
void configureHwcCommonData(const CompositionInfo& compositionInfo) const;