From: khizmax Date: Wed, 15 Apr 2015 20:35:21 +0000 (+0300) Subject: Relaxed memory order in SplitList X-Git-Tag: v2.1.0~257 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bd6f2902bfd40640d71f2f1a86f46087cbbb2d36;p=libcds.git Relaxed memory order in SplitList --- diff --git a/cds/intrusive/split_list.h b/cds/intrusive/split_list.h index 933c9943..d67ab64d 100644 --- a/cds/intrusive/split_list.h +++ b/cds/intrusive/split_list.h @@ -377,7 +377,7 @@ namespace cds { namespace intrusive { size_t bucket_no( size_t nHash ) const { - return nHash & ( (1 << m_nBucketCountLog2.load(atomics::memory_order_relaxed)) - 1 ); + return nHash & ( (1 << m_nBucketCountLog2.load(memory_model::memory_order_relaxed)) - 1 ); } static size_t parent_bucket( size_t nBucket ) @@ -460,10 +460,10 @@ namespace cds { namespace intrusive { void inc_item_count() { - size_t sz = m_nBucketCountLog2.load(atomics::memory_order_relaxed); + size_t sz = m_nBucketCountLog2.load(memory_model::memory_order_relaxed); if ( ( ++m_ItemCounter >> sz ) > m_Buckets.load_factor() && ((size_t)(1 << sz )) < m_Buckets.capacity() ) { - m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ); + m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, memory_model::memory_order_relaxed, atomics::memory_order_relaxed ); } } diff --git a/cds/intrusive/split_list_nogc.h b/cds/intrusive/split_list_nogc.h index 04994be5..8166312f 100644 --- a/cds/intrusive/split_list_nogc.h +++ b/cds/intrusive/split_list_nogc.h @@ -172,7 +172,7 @@ namespace cds { namespace intrusive { size_t bucket_no( size_t nHash ) const { - return nHash & ( (1 << m_nBucketCountLog2.load(atomics::memory_order_relaxed)) - 1 ); + return nHash & ( (1 << m_nBucketCountLog2.load(memory_model::memory_order_relaxed)) - 1 ); } static size_t parent_bucket( size_t nBucket ) @@ -255,10 +255,10 @@ namespace cds { namespace intrusive { void inc_item_count() { - size_t sz = m_nBucketCountLog2.load(atomics::memory_order_relaxed); + size_t sz = m_nBucketCountLog2.load(memory_model::memory_order_relaxed); if ( ( ++m_ItemCounter >> sz ) > m_Buckets.load_factor() && ((size_t)(1 << sz )) < m_Buckets.capacity() ) { - m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ); + m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, memory_model::memory_order_relaxed, atomics::memory_order_relaxed ); } } diff --git a/cds/intrusive/split_list_rcu.h b/cds/intrusive/split_list_rcu.h index 70f9ff3f..8a7916b4 100644 --- a/cds/intrusive/split_list_rcu.h +++ b/cds/intrusive/split_list_rcu.h @@ -269,7 +269,7 @@ namespace cds { namespace intrusive { size_t bucket_no( size_t nHash ) const { - return nHash & ( (1 << m_nBucketCountLog2.load(atomics::memory_order_relaxed)) - 1 ); + return nHash & ( (1 << m_nBucketCountLog2.load(memory_model::memory_order_relaxed)) - 1 ); } static size_t parent_bucket( size_t nBucket ) @@ -352,10 +352,10 @@ namespace cds { namespace intrusive { void inc_item_count() { - size_t sz = m_nBucketCountLog2.load(atomics::memory_order_relaxed); + size_t sz = m_nBucketCountLog2.load(memory_model::memory_order_relaxed); if ( ( ++m_ItemCounter >> sz ) > m_Buckets.load_factor() && ((size_t)(1 << sz )) < m_Buckets.capacity() ) { - m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ); + m_nBucketCountLog2.compare_exchange_strong( sz, sz + 1, memory_model::memory_order_relaxed, atomics::memory_order_relaxed ); } }