Annotate benign race on SkPath::fConvexity.
We're tired of this making our TSAN bot flaky, and equally tired of trying to fix it.
BUG=skia:5776
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4691
Change-Id: Ib6005282c514a6d785fd4fffe5387cbb1caccbe1
Reviewed-on: https://skia-review.googlesource.com/4691
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Ben Wagner <bungeman@google.com>
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 8241c10..6e201bd 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -13,6 +13,7 @@
#include "SkPathPriv.h"
#include "SkPathRef.h"
#include "SkRRect.h"
+#include "SkTSAN.h"
////////////////////////////////////////////////////////////////////////////
@@ -128,6 +129,8 @@
: fPathRef(SkPathRef::CreateEmpty()) {
this->resetFields();
fIsVolatile = false;
+ AnnotateBenignRaceSized(__FILE__, __LINE__, &fConvexity, sizeof(fConvexity),
+ "We've tried a few times to make this thread safe, and failed.");
}
void SkPath::resetFields() {
diff --git a/src/core/SkTSAN.h b/src/core/SkTSAN.h
new file mode 100644
index 0000000..8e00b9f
--- /dev/null
+++ b/src/core/SkTSAN.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkTSAN_DEFINED
+#define SkTSAN_DEFINED
+
+#if !defined(__has_feature)
+ #define __has_feature(x) 0
+#endif
+
+#if __has_feature(thread_sanitizer)
+ extern "C" void AnnotateBenignRaceSized(const char* file, int line,
+ const volatile void* ptr, long size,
+ const char* desc);
+#else
+ static inline void AnnotateBenignRaceSized(const char* file, int line,
+ const volatile void* ptr, long size,
+ const char* desc) {}
+#endif
+
+
+#endif//SkTSAN_DEFINED