From 763c751dc308158fc606ec0a91a9f3c8f88f0edc Mon Sep 17 00:00:00 2001 From: khizmax Date: Thu, 7 May 2015 23:18:55 +0300 Subject: [PATCH] TSan exam: SkipList --- cds/container/details/skip_list_base.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cds/container/details/skip_list_base.h b/cds/container/details/skip_list_base.h index 609e96b7..ed309c52 100644 --- a/cds/container/details/skip_list_base.h +++ b/cds/container/details/skip_list_base.h @@ -171,18 +171,24 @@ namespace cds { namespace container { template 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(pMem + c_nNodeSize) : nullptr, v ); + CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; + return p; } template 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(pMem + c_nNodeSize) : nullptr, std::forward(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(p), nHeight ); + CDS_TSAN_ANNOTATE_IGNORE_WRITES_END; } }; -- 2.34.1