Grab the tracing lock before calling the trace runner
The runner could be called from the binder thread
and the tracing or main thread depending on the
tracing configuration.
Fixes: 180041001
Test: added compile time thread saftey checks and manual tests
Change-Id: I636a6e16e8508cfe3f1672e6a4434b47b664e60f
diff --git a/services/surfaceflinger/SurfaceTracing.h b/services/surfaceflinger/SurfaceTracing.h
index 497ebd3..15a503d 100644
--- a/services/surfaceflinger/SurfaceTracing.h
+++ b/services/surfaceflinger/SurfaceTracing.h
@@ -81,8 +81,8 @@
SurfaceFlinger& mFlinger;
mutable std::mutex mTraceLock;
- bool mEnabled = false;
- std::unique_ptr<Runner> runner;
+ bool mEnabled GUARDED_BY(mTraceLock) = false;
+ std::unique_ptr<Runner> runner GUARDED_BY(mTraceLock);
struct Config {
uint32_t flags = TRACE_CRITICAL | TRACE_INPUT | TRACE_SYNC;