From d37901124a9181a3c63a4506fb5dd4700e285c46 Mon Sep 17 00:00:00 2001 From: khizmax Date: Sun, 3 Jan 2016 17:37:20 +0300 Subject: [PATCH] Formatting --- cds/urcu/details/base.h | 16 +++++++--------- cds/urcu/details/gp.h | 2 +- cds/urcu/details/gpi.h | 5 +++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/cds/urcu/details/base.h b/cds/urcu/details/base.h index 97f617bb..dc7aedec 100644 --- a/cds/urcu/details/base.h +++ b/cds/urcu/details/base.h @@ -292,8 +292,8 @@ namespace cds { //@cond template struct thread_list_record { - ThreadData * m_pNext ; ///< Next item in thread list - atomics::atomic m_idOwner ; ///< Owner thread id; 0 - the record is free (not owned) + ThreadData * m_pNext; ///< Next item in thread list + atomics::atomic m_idOwner; ///< Owner thread id; 0 - the record is free (not owned) thread_list_record() : m_pNext( nullptr ) @@ -309,11 +309,11 @@ namespace cds { template class thread_list { public: - typedef thread_data thread_record; - typedef cds::details::Allocator< thread_record, Alloc > allocator_type; + typedef thread_data thread_record; + typedef cds::details::Allocator< thread_record, Alloc > allocator_type; private: - atomics::atomic m_pHead; + atomics::atomic m_pHead; public: thread_list() @@ -331,7 +331,7 @@ namespace cds { cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId; cds::OS::ThreadId const curThreadId = cds::OS::get_current_thread_id(); - // First try to reuse a retired (non-active) HP record + // First, try to reuse a retired (non-active) HP record for ( pRec = m_pHead.load( atomics::memory_order_acquire ); pRec; pRec = pRec->m_list.m_pNext ) { cds::OS::ThreadId thId = nullThreadId; if ( !pRec->m_list.m_idOwner.compare_exchange_strong( thId, curThreadId, atomics::memory_order_seq_cst, atomics::memory_order_relaxed ) ) @@ -344,8 +344,6 @@ namespace cds { pRec = allocator_type().New(); pRec->m_list.m_idOwner.store( curThreadId, atomics::memory_order_relaxed ); - atomics::atomic_thread_fence( atomics::memory_order_release ); - thread_record * pOldHead = m_pHead.load( atomics::memory_order_acquire ); do { pRec->m_list.m_pNext = pOldHead; @@ -385,7 +383,7 @@ namespace cds { CDS_DEBUG_ONLY( cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId; ) CDS_DEBUG_ONLY( cds::OS::ThreadId const mainThreadId = cds::OS::get_current_thread_id() ;) - thread_record * p = m_pHead.exchange( nullptr, atomics::memory_order_seq_cst ); + thread_record * p = m_pHead.exchange( nullptr, atomics::memory_order_acquire ); while ( p ) { thread_record * pNext = p->m_list.m_pNext; diff --git a/cds/urcu/details/gp.h b/cds/urcu/details/gp.h index 7cde5db0..f17762b7 100644 --- a/cds/urcu/details/gp.h +++ b/cds/urcu/details/gp.h @@ -75,7 +75,7 @@ namespace cds { namespace urcu { namespace details { { uint32_t const v = pRec->m_nAccessControl.load( atomics::memory_order_acquire ); return (v & general_purpose_rcu::c_nNestMask) - && ((( v ^ m_nGlobalControl.load( atomics::memory_order_relaxed )) & ~general_purpose_rcu::c_nNestMask )); + && (( v ^ m_nGlobalControl.load( atomics::memory_order_relaxed )) & ~general_purpose_rcu::c_nNestMask ); } template diff --git a/cds/urcu/details/gpi.h b/cds/urcu/details/gpi.h index 23c105e1..afca407b 100644 --- a/cds/urcu/details/gpi.h +++ b/cds/urcu/details/gpi.h @@ -60,7 +60,7 @@ namespace cds { namespace urcu { /// Returns singleton instance static general_instant * instance() { - return static_cast( base_class::instance() ); + return static_cast( base_class::instance()); } /// Checks if the singleton is created and ready to use @@ -105,7 +105,7 @@ namespace cds { namespace urcu { public: /// Retires \p p pointer /** - The method calls \ref synchronize to wait for the end of grace period + The method calls \p synchronize() to wait for the end of grace period and calls \p p disposer. */ virtual void retire_ptr( retired_ptr& p ) @@ -148,6 +148,7 @@ namespace cds { namespace urcu { /// Waits to finish a grace period void synchronize() { + assert( !is_locked()); std::unique_lock sl( m_Lock ); flip_and_wait(); flip_and_wait(); -- 2.34.1