From: khizmax Date: Thu, 14 May 2015 21:00:17 +0000 (+0300) Subject: TSan exam: EllenBinTree, FCPriorityQueue X-Git-Tag: v2.1.0~238 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=97438a7bbd946a95c9427fe03c366766e3c909b0;hp=2e75cfb05e478f1f6f91c8b80217217696ac2897;p=libcds.git TSan exam: EllenBinTree, FCPriorityQueue --- diff --git a/cds/container/fcpriority_queue.h b/cds/container/fcpriority_queue.h index c98f155b..163537ed 100644 --- a/cds/container/fcpriority_queue.h +++ b/cds/container/fcpriority_queue.h @@ -259,6 +259,9 @@ namespace cds { namespace container { { assert( pRec ); + // this function is called under FC mutex, so switch TSan off + CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN; + switch ( pRec->op() ) { case op_push: assert( pRec->pValPush ); @@ -287,6 +290,8 @@ namespace cds { namespace container { assert(false); break; } + + CDS_TSAN_ANNOTATE_IGNORE_RW_END; } //@endcond }; diff --git a/cds/intrusive/impl/ellen_bintree.h b/cds/intrusive/impl/ellen_bintree.h index a3ae991b..c422c24c 100644 --- a/cds/intrusive/impl/ellen_bintree.h +++ b/cds/intrusive/impl/ellen_bintree.h @@ -1235,25 +1235,28 @@ namespace cds { namespace intrusive { if ( nCmp < 0 ) { if ( res.pGrandParent ) { assert( !res.pLeaf->infinite_key() ); - pNewInternal->infinite_key( 0 ); // TSan false positive: there is the release fence below, pNewInternal is not linked yet CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN; + pNewInternal->infinite_key( 0 ); key_extractor()(pNewInternal->m_Key, *node_traits::to_value_ptr( res.pLeaf )); CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; } else { assert( res.pLeaf->infinite_key() == tree_node::key_infinite1 ); + // TSan false positive: there is the release fence below, pNewInternal is not linked yet + CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN; pNewInternal->infinite_key( 1 ); + CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; } pNewInternal->m_pLeft.store( static_cast(pNewLeaf), memory_model::memory_order_relaxed ); pNewInternal->m_pRight.store( static_cast(res.pLeaf), memory_model::memory_order_release ); } else { assert( !res.pLeaf->is_internal() ); - pNewInternal->infinite_key( 0 ); // TSan false positive: there is the release fence below, pNewInternal is not linked yet CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN; + pNewInternal->infinite_key( 0 ); key_extractor()(pNewInternal->m_Key, val); CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; pNewInternal->m_pLeft.store( static_cast(res.pLeaf), memory_model::memory_order_relaxed );