From c51a3a4e3c81a1d4100d5d29d31bf3a02eda2a7c Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Thu, 10 Nov 2016 18:09:51 -0500 Subject: [PATCH] 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 Reviewed-by: Ben Wagner --- src/core/SkPath.cpp | 3 +++ src/core/SkTSAN.h | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/core/SkTSAN.h diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 8241c10f8e..6e201bd204 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 @@ SkPath::SkPath() : 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 0000000000..8e00b9fc29 --- /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 -- 2.34.1