From: khizmax Date: Sat, 28 Nov 2015 11:21:58 +0000 (+0300) Subject: Small improvements in TsigasCycleQueue X-Git-Tag: v2.1.0~55 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dd86eedf13d944c7c6e7f80cbc61dfdc9c848bab;p=libcds.git Small improvements in TsigasCycleQueue --- diff --git a/cds/intrusive/tsigas_cycle_queue.h b/cds/intrusive/tsigas_cycle_queue.h index 4dd15789..79a34dbd 100644 --- a/cds/intrusive/tsigas_cycle_queue.h +++ b/cds/intrusive/tsigas_cycle_queue.h @@ -184,7 +184,7 @@ namespace cds { namespace intrusive { static bool is_free( const value_type * p ) CDS_NOEXCEPT { - return p == reinterpret_cast(free0) || p == reinterpret_cast(free1); + return (reinterpret_cast(p) & ~intptr_t(1)) == 0; } size_t CDS_CONSTEXPR buffer_capacity() const CDS_NOEXCEPT @@ -248,7 +248,7 @@ namespace cds { namespace intrusive { temp = (temp + 1) & nModulo; } - if ( te != m_nTail.load(memory_model::memory_order_relaxed) ) + if ( te != m_nTail.load(memory_model::memory_order_acquire) ) continue; // Check whether queue is full @@ -266,7 +266,7 @@ namespace cds { namespace intrusive { if ( tt == reinterpret_cast(free1) ) pNewNode = reinterpret_cast(reinterpret_cast( pNewNode ) | 1); - if ( te != m_nTail.load(memory_model::memory_order_relaxed) ) + if ( te != m_nTail.load(memory_model::memory_order_acquire) ) continue; // get actual tail and try to enqueue new node