Removed redundant spaces
[libcds.git] / cds / sync / spinlock.h
index dec8232191ffc0914925cfaf372025b2f360320f..1708bba0c4abc8f2a37b5209877cdc943d8495cb 100644 (file)
@@ -111,7 +111,7 @@ namespace cds {
             /// Destructor. On debug time it checks whether spin-lock is free
             ~spin_lock()
             {
-                assert( !m_spin.load( atomics::memory_order_relaxed ) );
+                assert( !m_spin.load( atomics::memory_order_relaxed ));
             }
 
             /// Check if the spin is locked
@@ -145,11 +145,11 @@ namespace cds {
                 Returns \p true if locking is succeeded
                 otherwise (if the spin is already locked) returns \p false
             */
-            bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() ) )
+            bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()()) )
             {
                 backoff_strategy backoff;
                 while ( nTryCount-- ) {
-                    if ( try_lock() )
+                    if ( try_lock())
                         return true;
                     backoff();
                 }
@@ -157,28 +157,28 @@ namespace cds {
             }
 
             /// Lock the spin-lock. Waits infinitely while spin-lock is locked. Debug version: deadlock may be detected
-            void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()() ))
+            void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()()))
             {
                 backoff_strategy backoff;
 
                 // Deadlock detected
-                assert( m_dbgOwnerId != OS::get_current_thread_id() );
+                assert( m_dbgOwnerId != OS::get_current_thread_id());
 
                 // TATAS algorithm
-                while ( !try_lock() ) {
-                    while ( m_spin.load( atomics::memory_order_relaxed ) ) {
+                while ( !try_lock()) {
+                    while ( m_spin.load( atomics::memory_order_relaxed )) {
                         backoff();
                     }
                 }
-                assert( m_dbgOwnerId == OS::get_current_thread_id() );
+                assert( m_dbgOwnerId == OS::get_current_thread_id());
             }
 
             /// Unlock the spin-lock. Debug version: deadlock may be detected
             void unlock() CDS_NOEXCEPT
             {
-                assert( m_spin.load( atomics::memory_order_relaxed ) );
+                assert( m_spin.load( atomics::memory_order_relaxed ));
 
-                assert( m_dbgOwnerId == OS::get_current_thread_id() );
+                assert( m_dbgOwnerId == OS::get_current_thread_id());
                 CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; )
 
                 m_spin.store( false, atomics::memory_order_release );
@@ -241,24 +241,24 @@ namespace cds {
                 return m_spin.compare_exchange_weak( nCurrent, 1, atomics::memory_order_acquire, atomics::memory_order_relaxed );
             }
 
-            bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() ))
+            bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()()))
             {
                 backoff_strategy bkoff;
 
                 while ( nTryCount-- ) {
-                    if ( try_acquire() )
+                    if ( try_acquire())
                         return true;
                     bkoff();
                 }
                 return false;
             }
 
-            void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()() ))
+            void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()()))
             {
                 // TATAS algorithm
                 backoff_strategy bkoff;
-                while ( !try_acquire() ) {
-                    while ( m_spin.load( atomics::memory_order_relaxed ) )
+                while ( !try_acquire()) {
+                    while ( m_spin.load( atomics::memory_order_relaxed ))
                         bkoff();
                 }
             }
@@ -298,14 +298,14 @@ namespace cds {
             */
             bool is_locked() const CDS_NOEXCEPT
             {
-                return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id() ));
+                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 \p try_lock())
             bool try_lock() CDS_NOEXCEPT
             {
                 thread_id tid = OS::get_current_thread_id();
-                if ( try_taken_lock( tid ) )
+                if ( try_taken_lock( tid ))
                     return true;
                 if ( try_acquire()) {
                     take( tid );
@@ -318,7 +318,7 @@ namespace cds {
             bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( std::declval<reentrant_spin_lock>().try_acquire( nTryCount )))
             {
                 thread_id tid = OS::get_current_thread_id();
-                if ( try_taken_lock( tid ) )
+                if ( try_taken_lock( tid ))
                     return true;
                 if ( try_acquire( nTryCount )) {
                     take( tid );
@@ -331,7 +331,7 @@ namespace cds {
             void lock() CDS_NOEXCEPT_( noexcept( std::declval<reentrant_spin_lock>().acquire()))
             {
                 thread_id tid = OS::get_current_thread_id();
-                if ( !try_taken_lock( tid ) ) {
+                if ( !try_taken_lock( tid )) {
                     acquire();
                     take( tid );
                 }
@@ -340,7 +340,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::get_current_thread_id() ) ) {
+                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 );
@@ -356,7 +356,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::get_current_thread_id() ) ) {
+                if ( is_taken( OS::get_current_thread_id()) ) {
                     assert( newOwnerId != OS::c_NullThreadId );
                     m_OwnerId = newOwnerId;
                     return true;