Formatting
authorkhizmax <libcds.dev@gmail.com>
Sun, 3 Jan 2016 14:37:20 +0000 (17:37 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sun, 3 Jan 2016 14:37:20 +0000 (17:37 +0300)
cds/urcu/details/base.h
cds/urcu/details/gp.h
cds/urcu/details/gpi.h

index 97f617bbe8983c7519bb2de4a5110752f9697869..dc7aedec90e5b8147e9156ce99e4cf38e41c3fde 100644 (file)
@@ -292,8 +292,8 @@ namespace cds {
             //@cond
             template <typename ThreadData>
             struct thread_list_record {
-                ThreadData *    m_pNext ;  ///< Next item in thread list
-                atomics::atomic<OS::ThreadId>    m_idOwner   ; ///< Owner thread id; 0 - the record is free (not owned)
+                ThreadData *                  m_pNext;   ///< Next item in thread list
+                atomics::atomic<OS::ThreadId> 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 <typename RCUtag, class Alloc = CDS_DEFAULT_ALLOCATOR >
             class thread_list {
             public:
-                typedef thread_data<RCUtag>         thread_record;
-                typedef cds::details::Allocator< thread_record, Alloc >   allocator_type;
+                typedef thread_data<RCUtag>                             thread_record;
+                typedef cds::details::Allocator< thread_record, Alloc > allocator_type;
 
             private:
-                atomics::atomic<thread_record *>   m_pHead;
+                atomics::atomic<thread_record *> 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;
 
index 7cde5db0da21fe0b700e1017e018cc8db0fd869e..f17762b721d312a7de034ab2f2fe46c158fc7eb3 100644 (file)
@@ -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 <typename RCUtag>
index 23c105e18b938f3b37bdf3b8542676a6a2924898..afca407bde99e8a457fdb153230ce0551fa50ff5 100644 (file)
@@ -60,7 +60,7 @@ namespace cds { namespace urcu {
         /// Returns singleton instance
         static general_instant * instance()
         {
-            return static_cast<general_instant *>( base_class::instance() );
+            return static_cast<general_instant *>( 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<lock_type> sl( m_Lock );
             flip_and_wait();
             flip_and_wait();