Renamed getCurrentThreadId to get_current_thread_id
authorkhizmax <libcds.dev@gmail.com>
Sat, 29 Nov 2014 11:45:12 +0000 (14:45 +0300)
committerkhizmax <libcds.dev@gmail.com>
Sat, 29 Nov 2014 11:45:12 +0000 (14:45 +0300)
cds/intrusive/cuckoo_set.h
cds/intrusive/mspriority_queue.h
cds/intrusive/striped_set/striping_policy.h
cds/lock/spinlock.h
cds/os/posix/thread.h
cds/os/win/thread.h
cds/urcu/details/base.h
src/dllmain.cpp
src/hp_gc.cpp
tests/unit/map2/map_insdel_func.cpp
tests/unit/set2/set_insdel_func.h

index aa0e24426af9c6e69b20f8e3922e586c8d47e5db..e747ac37c852e6e6b5fbe46a96fc0eead189e134 100644 (file)
@@ -679,7 +679,7 @@ namespace cds { namespace intrusive {
 
             void acquire( size_t const * arrHash, lock_array_ptr * pLockArr, lock_type ** parrLock )
             {
-                owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+                owner_t me = (owner_t) cds::OS::get_current_thread_id();
                 owner_t who;
 
                 back_off bkoff;
@@ -758,7 +758,7 @@ namespace cds { namespace intrusive {
 
             void acquire_all()
             {
-                owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+                owner_t me = (owner_t) cds::OS::get_current_thread_id();
 
                 back_off bkoff;
                 while ( true ) {
@@ -782,7 +782,7 @@ namespace cds { namespace intrusive {
 
             void acquire_resize( lock_array_ptr * pOldLocks )
             {
-                owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+                owner_t me = (owner_t) cds::OS::get_current_thread_id();
 
                 while ( true ) {
                     {
index 2788fa3a282bde9bc2d82dc1daeacea45d883170..eca32914b3e9355f6a5b763e96842adb67638e54 100644 (file)
@@ -240,7 +240,7 @@ namespace cds { namespace intrusive {
         */
         bool push( value_type& val )
         {
-            tag_type const curId = cds::OS::getCurrentThreadId();
+            tag_type const curId = cds::OS::get_current_thread_id();
 
             // Insert new item at bottom of the heap
             m_Lock.lock();
index 46333d64f398654f13accd2b3a267e772529d7a9..8404bde9db1062017d984112bd74e510ee6fb8a5 100644 (file)
@@ -175,7 +175,7 @@ namespace cds { namespace intrusive { namespace striped_set {
 
         lock_type& acquire( size_t nHash )
         {
-            owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+            owner_t me = (owner_t) cds::OS::get_current_thread_id();
             owner_t who;
 
             back_off bkoff;
@@ -206,7 +206,7 @@ namespace cds { namespace intrusive { namespace striped_set {
 
         lock_array_ptr acquire_all()
         {
-            owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+            owner_t me = (owner_t) cds::OS::get_current_thread_id();
             owner_t who;
 
             back_off bkoff;
@@ -242,7 +242,7 @@ namespace cds { namespace intrusive { namespace striped_set {
 
         bool acquire_resize()
         {
-            owner_t me = (owner_t) cds::OS::getCurrentThreadId();
+            owner_t me = (owner_t) cds::OS::get_current_thread_id();
 
             back_off bkoff;
             for (unsigned int nAttempts = 0; nAttempts < 32; ++nAttempts ) {
index b5bf19eddbd571ea102b8c5507c1b07b466db1c7..dbe729db8c8ccad29eb6b346234c1174fd671392 100644 (file)
@@ -70,7 +70,7 @@ namespace cds {
             */
             Spinlock( bool bLocked ) CDS_NOEXCEPT
 #    ifdef CDS_DEBUG
-                : m_dbgOwnerId( bLocked ? OS::getCurrentThreadId() : OS::c_NullThreadId )
+                : m_dbgOwnerId( bLocked ? OS::get_current_thread_id() : OS::c_NullThreadId )
 #    endif
             {
                 m_spin.store( bLocked, atomics::memory_order_relaxed );
@@ -115,7 +115,7 @@ namespace cds {
 
                 CDS_DEBUG_ONLY(
                     if ( !bCurrent ) {
-                        m_dbgOwnerId = OS::getCurrentThreadId();
+                        m_dbgOwnerId = OS::get_current_thread_id();
                     }
                 )
                 return !bCurrent;
@@ -143,7 +143,7 @@ namespace cds {
                 backoff_strategy backoff;
 
                 // Deadlock detected
-                assert( m_dbgOwnerId != OS::getCurrentThreadId() );
+                assert( m_dbgOwnerId != OS::get_current_thread_id() );
 
                 // TATAS algorithm
                 while ( !try_lock() ) {
@@ -151,7 +151,7 @@ namespace cds {
                         backoff();
                     }
                 }
-                assert( m_dbgOwnerId == OS::getCurrentThreadId() );
+                assert( m_dbgOwnerId == OS::get_current_thread_id() );
             }
 
             /// Unlock the spin-lock. Debug version: deadlock may be detected
@@ -159,7 +159,7 @@ namespace cds {
             {
                 assert( m_spin.load( atomics::memory_order_relaxed ) );
 
-                assert( m_dbgOwnerId == OS::getCurrentThreadId() );
+                assert( m_dbgOwnerId == OS::get_current_thread_id() );
                 CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; )
 
                 m_spin.store( false, atomics::memory_order_release );
@@ -279,13 +279,13 @@ namespace cds {
             */
             bool is_locked() const CDS_NOEXCEPT
             {
-                return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::getCurrentThreadId() ));
+                return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id() ));
             }
 
             /// Try to lock the spin-lock (synonym for \ref try_lock)
             bool try_lock() CDS_NOEXCEPT
             {
-                thread_id tid = OS::getCurrentThreadId();
+                thread_id tid = OS::get_current_thread_id();
                 if ( try_taken_lock( tid ) )
                     return true;
                 if ( try_acquire()) {
@@ -298,7 +298,7 @@ namespace cds {
             /// Try to lock the object
             bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( try_acquire( nTryCount ) ) )
             {
-                thread_id tid = OS::getCurrentThreadId();
+                thread_id tid = OS::get_current_thread_id();
                 if ( try_taken_lock( tid ) )
                     return true;
                 if ( try_acquire( nTryCount )) {
@@ -311,7 +311,7 @@ namespace cds {
             /// Lock the object waits if it is busy
             void lock() CDS_NOEXCEPT
             {
-                thread_id tid = OS::getCurrentThreadId();
+                thread_id tid = OS::get_current_thread_id();
                 if ( !try_taken_lock( tid ) ) {
                     acquire();
                     take( tid );
@@ -321,7 +321,7 @@ namespace cds {
             /// Unlock the spin-lock. Return @p true if the current thread is owner of spin-lock @p false otherwise
             bool unlock() CDS_NOEXCEPT
             {
-                if ( is_taken( OS::getCurrentThreadId() ) ) {
+                if ( is_taken( OS::get_current_thread_id() ) ) {
                     integral_type n = m_spin.load( atomics::memory_order_relaxed );
                     if ( n > 1 )
                         m_spin.store( n - 1, atomics::memory_order_relaxed );
@@ -337,7 +337,7 @@ namespace cds {
             /// Change the owner of locked spin-lock. May be called by thread that is owner of the spin-lock
             bool change_owner( OS::ThreadId newOwnerId ) CDS_NOEXCEPT
             {
-                if ( is_taken( OS::getCurrentThreadId() ) ) {
+                if ( is_taken( OS::get_current_thread_id() ) ) {
                     assert( newOwnerId != OS::c_NullThreadId );
                     m_OwnerId = newOwnerId;
                     return true;
index adaf022e0299e27c154bfe3bf7b0666b9b9cc581..b2531847509f6a32bf1e5972b85fe5e0837e59a6 100644 (file)
@@ -8,13 +8,13 @@
 
 namespace cds { namespace OS {
     /// posix-related wrappers
-    CDS_CXX11_INLINE_NAMESPACE namespace posix {
+    inline namespace posix {
 
         /// Posix thread id type
         typedef std::thread::native_handle_type ThreadId;
 
         /// Get current thread id
-        static inline ThreadId getCurrentThreadId()
+        static inline ThreadId get_current_thread_id()
         {
             return pthread_self();
         }
@@ -29,14 +29,9 @@ namespace cds { namespace OS {
         }
     }    // namespace posix
 
+    //@cond
     constexpr const posix::ThreadId c_NullThreadId = 0;
-
-#ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
-    using posix::ThreadId;
-
-    using posix::getCurrentThreadId;
-    using posix::isThreadAlive;
-#endif
+    //@endcond
 
 }} // namespace cds::OS
 
index 0e3d66466d55b4f1cd7230c9587530366c39cbee..15fd57f2a01cae365b1a4215e4d561f95538eaff 100644 (file)
@@ -13,7 +13,7 @@ namespace cds { namespace OS {
         typedef DWORD           ThreadId;
 
         /// Get current thread id
-        static inline ThreadId getCurrentThreadId()
+        static inline ThreadId get_current_thread_id()
         {
             return ::GetCurrentThreadId();
         }
@@ -34,7 +34,7 @@ namespace cds { namespace OS {
 
 #ifndef CDS_CXX11_INLINE_NAMESPACE_SUPPORT
     using Win32::ThreadId;
-    using Win32::getCurrentThreadId;
+    using Win32::get_current_thread_id;
     using Win32::isThreadAlive;
 #endif
     //@endcond
index bcb7c53a1bac20b1555d9cbd2724d3ef4fdc2c88..b480ccff8fbb4e0a42b956d299a6d9946deadb1c 100644 (file)
@@ -330,7 +330,7 @@ namespace cds {
                 {
                     thread_record * pRec;
                     cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId;
-                    cds::OS::ThreadId const curThreadId  = cds::OS::getCurrentThreadId();
+                    cds::OS::ThreadId const curThreadId  = cds::OS::get_current_thread_id();
 
                     // 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 ) {
@@ -384,7 +384,7 @@ namespace cds {
                 {
                     allocator_type al;
                     CDS_DEBUG_ONLY( cds::OS::ThreadId const nullThreadId = cds::OS::c_NullThreadId; )
-                    CDS_DEBUG_ONLY( cds::OS::ThreadId const mainThreadId = cds::OS::getCurrentThreadId() ;)
+                    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 );
                     while ( p ) {
index 14ce22e4569133dd924b5be51bb0f06193afcce2..5d1a8f85fe91f339e932c23d5947719ec128e48c 100644 (file)
@@ -191,7 +191,7 @@ BOOL WINAPI DllMain(
     switch ( fdwReason ) {
         case DLL_PROCESS_ATTACH:
             s_DllInstance = hinstDLL;
-            s_MainThreadId = cds::OS::getCurrentThreadId();
+            s_MainThreadId = cds::OS::get_current_thread_id();
 #if _WIN32_WINNT < 0x0601
             discover_topology();
 #endif
index dec6e245665949b693153d65123dd713bc1225ed..7bbcb73e59de39d52dfa72d8583915144d58507f 100644 (file)
@@ -59,7 +59,7 @@ namespace cds { namespace gc {
         GarbageCollector::~GarbageCollector()
         {
             CDS_DEBUG_ONLY( const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId; )
-            CDS_DEBUG_ONLY( const cds::OS::ThreadId mainThreadId = cds::OS::getCurrentThreadId() ;)
+            CDS_DEBUG_ONLY( const cds::OS::ThreadId mainThreadId = cds::OS::get_current_thread_id() ;)
 
             hplist_node * pHead = m_pListHead.load( atomics::memory_order_relaxed );
             m_pListHead.store( nullptr, atomics::memory_order_relaxed );
@@ -103,7 +103,7 @@ namespace cds { namespace gc {
 
             hplist_node * hprec;
             const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId;
-            const cds::OS::ThreadId curThreadId  = cds::OS::getCurrentThreadId();
+            const cds::OS::ThreadId curThreadId  = cds::OS::get_current_thread_id();
 
             // First try to reuse a retired (non-active) HP record
             for ( hprec = m_pListHead.load( atomics::memory_order_acquire ); hprec; hprec = hprec->m_pNextNode ) {
@@ -290,10 +290,10 @@ namespace cds { namespace gc {
         {
             CDS_HAZARDPTR_STATISTIC( ++m_Stat.m_HelpScanCallCount )
 
-            assert( static_cast<hplist_node *>(pThis)->m_idOwner.load(atomics::memory_order_relaxed) == cds::OS::getCurrentThreadId() );
+            assert( static_cast<hplist_node *>(pThis)->m_idOwner.load(atomics::memory_order_relaxed) == cds::OS::get_current_thread_id() );
 
             const cds::OS::ThreadId nullThreadId = cds::OS::c_NullThreadId;
-            const cds::OS::ThreadId curThreadId = cds::OS::getCurrentThreadId();
+            const cds::OS::ThreadId curThreadId = cds::OS::get_current_thread_id();
             for ( hplist_node * hprec = m_pListHead.load(atomics::memory_order_acquire); hprec; hprec = hprec->m_pNextNode ) {
 
                 // If m_bFree == true then hprec->m_arrRetired is empty - we don't need to see it
index 719c1c7c8cc8c9d40c738e9b88d6f881a8caf196..46b53ddd1f3449e5f6329eeb579017fb8992cc46 100644 (file)
@@ -44,7 +44,7 @@ namespace map2 {
                 , nData(0)
                 , nEnsureCall(0)
                 , bInitialized( false )
-                , threadId( cds::OS::getCurrentThreadId() )
+                , threadId( cds::OS::get_current_thread_id() )
             {}
 
             value_type( value_type const& s )
@@ -52,7 +52,7 @@ namespace map2 {
                 , nData(s.nData)
                 , nEnsureCall(s.nEnsureCall.load(atomics::memory_order_relaxed))
                 , bInitialized( s.bInitialized.load(atomics::memory_order_relaxed) )
-                , threadId( cds::OS::getCurrentThreadId() )
+                , threadId( cds::OS::get_current_thread_id() )
             {}
 
             // boost::container::flat_map requires operator =
index 313ba0df5a00d41ff970fcc257870a5473134407..6c75a97cd4a2b48bd6ef22720142acfd5c8a80b5 100644 (file)
@@ -42,7 +42,7 @@ namespace set2 {
                 , nData(0)
                 , nEnsureCall(0)
                 , bInitialized( false )
-                , threadId( cds::OS::getCurrentThreadId() )
+                , threadId( cds::OS::get_current_thread_id() )
             {}
 
             value_type( value_type const& s )
@@ -50,7 +50,7 @@ namespace set2 {
                 , nData(s.nData)
                 , nEnsureCall(s.nEnsureCall.load(atomics::memory_order_relaxed))
                 , bInitialized( s.bInitialized )
-                , threadId( cds::OS::getCurrentThreadId() )
+                , threadId( cds::OS::get_current_thread_id() )
             {}
 
             // boost::container::flat_map requires operator =