[opencv] 175/251: core(tls): hide assertions from Thread Sanitizer

Nobuhiro Iwamatsu iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.

commit d35422b5234761deef85e46ee84f109fb11010e9
Author: Alexander Alekhin <alexander.alekhin at intel.com>
Date:   Thu Jul 27 17:31:51 2017 +0300

    core(tls): hide assertions from Thread Sanitizer
---
 modules/core/include/opencv2/core/cvdef.h | 11 +++++++++++
 modules/core/src/system.cpp               |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/modules/core/include/opencv2/core/cvdef.h b/modules/core/include/opencv2/core/cvdef.h
index 2ac0e17..70bbf93 100644
--- a/modules/core/include/opencv2/core/cvdef.h
+++ b/modules/core/include/opencv2/core/cvdef.h
@@ -328,6 +328,17 @@ Cv64suf;
 #endif
 
 /****************************************************************************************\
+*                                    Thread sanitizer                                    *
+\****************************************************************************************/
+#ifndef CV_THREAD_SANITIZER
+# if defined(__has_feature)
+#   if __has_feature(thread_sanitizer)
+#     define CV_THREAD_SANITIZER
+#   endif
+# endif
+#endif
+
+/****************************************************************************************\
 *          exchange-add operation for atomic operations on reference counters            *
 \****************************************************************************************/
 
diff --git a/modules/core/src/system.cpp b/modules/core/src/system.cpp
index 629c3fb..7ea0dd6 100644
--- a/modules/core/src/system.cpp
+++ b/modules/core/src/system.cpp
@@ -1396,7 +1396,9 @@ public:
     // Get data by TLS storage index
     void* getData(size_t slotIdx) const
     {
+#ifndef CV_THREAD_SANITIZER
         CV_Assert(tlsSlotsSize > slotIdx);
+#endif
 
         ThreadData* threadData = (ThreadData*)tls.GetData();
         if(threadData && threadData->slots.size() > slotIdx)
@@ -1426,7 +1428,9 @@ public:
     // Set data to storage index
     void setData(size_t slotIdx, void* pData)
     {
+#ifndef CV_THREAD_SANITIZER
         CV_Assert(tlsSlotsSize > slotIdx);
+#endif
 
         ThreadData* threadData = (ThreadData*)tls.GetData();
         if(!threadData)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git



More information about the debian-science-commits mailing list