drm_hwcomposer: Use clang thread-safety analysis in VSyncWorker

See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html for details.
Define thread annotation macros according to the example provided in the
documentation, and use these to annotate VSyncWorker members that can be
accessed from multiple threads.

Thread safety analysis does not yet work with std::unique_lock, so
disable the warnings when it is used.

Change-Id: I8b3b503fbaf0923588fbe3d0180f6fe6ec228350
Signed-off-by: Drew Davenport <ddavenport@google.com>
diff --git a/drm/VSyncWorker.cpp b/drm/VSyncWorker.cpp
index 6dd6b02..5234f6b 100644
--- a/drm/VSyncWorker.cpp
+++ b/drm/VSyncWorker.cpp
@@ -159,6 +159,9 @@
   for (;;) {
     {
       std::unique_lock<std::mutex> lock(mutex_);
+      // Thread safety analysis doesn't understand std::unique_lock.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wthread-safety-analysis"
       if (thread_exit_)
         break;
 
@@ -167,6 +170,7 @@
 
       if (!enabled_)
         continue;
+#pragma clang diagnostic pop
     }
 
     ret = -EAGAIN;