Changed mNumLayers to atomic
mNumLayers is accessed from multiple threads, binder thread when a layer
is created and main thread when a layer is destroyed. The variable
should be atomic to ensure it's thread safe.
Test: Builds and runs
Change-Id: I72962d148dfdeec8e1877b86f93cc53c8c7883a9
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 3974a8c..03f620a 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -1072,7 +1072,7 @@
// Static screen stats
bool mHasPoweredOff = false;
- size_t mNumLayers = 0;
+ std::atomic<size_t> mNumLayers = 0;
// Verify that transaction is being called by an approved process:
// either AID_GRAPHICS or AID_SYSTEM.