TSan exam: SkipList
authorkhizmax <libcds.dev@gmail.com>
Thu, 7 May 2015 20:18:55 +0000 (23:18 +0300)
committerkhizmax <libcds.dev@gmail.com>
Thu, 7 May 2015 20:18:55 +0000 (23:18 +0300)
cds/container/details/skip_list_base.h

index 609e96b743272c4584019c66a78a08bf9ea66cdc..ed309c5214f6ea4d439d49199cf6ac8cfeb6bdff 100644 (file)
@@ -171,18 +171,24 @@ namespace cds { namespace container {
                 template <typename Q>
                 node_type * New( unsigned int nHeight, Q const& v )
                 {
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN;
                     unsigned char * pMem = alloc_space( nHeight );
-                    return new( pMem )
+                    node_type * p = new( pMem )
                         node_type( nHeight, nHeight > 1 ? reinterpret_cast<node_tower_item *>(pMem + c_nNodeSize) : nullptr, v );
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_END;
+                    return p;
                 }
 
                 template <typename... Args>
                 node_type * New( unsigned int nHeight, Args&&... args )
                 {
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN;
                     unsigned char * pMem = alloc_space( nHeight );
-                    return new( pMem )
+                    node_type * p = new( pMem )
                         node_type( nHeight, nHeight > 1 ? reinterpret_cast<node_tower_item *>(pMem + c_nNodeSize) : nullptr,
                         std::forward<Args>(args)... );
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_END;
+                    return p;
                 }
 
                 void Delete( node_type * p )
@@ -191,7 +197,9 @@ namespace cds { namespace container {
 
                     unsigned int nHeight = p->height();
                     node_allocator_type().destroy( p );
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_BEGIN;
                     free_space( reinterpret_cast<unsigned char *>(p), nHeight );
+                    CDS_TSAN_ANNOTATE_IGNORE_WRITES_END;
                 }
             };