Removed redundant spaces
[libcds.git] / cds / threading / details / _common.h
index 73db0ec43e577c27874a8a818959d9253c5e757a..dcc1faf0ae7ade4ddd01d064a08e2124a33da050 100644 (file)
@@ -1,7 +1,35 @@
-//$$CDS-header$$
+/*
+    This file is a part of libcds - Concurrent Data Structures library
 
-#ifndef __CDS_THREADING__COMMON_H
-#define __CDS_THREADING__COMMON_H
+    (C) Copyright Maxim Khizhinsky (libcds.dev@gmail.com) 2006-2016
+
+    Source code repo: http://github.com/khizmax/libcds/
+    Download: http://sourceforge.net/projects/libcds/files/
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice, this
+      list of conditions and the following disclaimer.
+
+    * Redistributions in binary form must reproduce the above copyright notice,
+      this list of conditions and the following disclaimer in the documentation
+      and/or other materials provided with the distribution.
+
+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef CDSLIB_THREADING__COMMON_H
+#define CDSLIB_THREADING__COMMON_H
 
 #include <cds/gc/impl/hp_decl.h>
 #include <cds/gc/impl/dhp_decl.h>
@@ -18,7 +46,7 @@ namespace cds {
         The library does not dictate any thread model. To embed the library to your application you should choose
         appropriate implementation of \p cds::threading::Manager interface
         or should provide yourself.
-        The \p %cds::threading::Manager interface manages \p ñds::threading::ThreadData structure that contains GC's thread specific data.
+        The \p %cds::threading::Manager interface manages \p cds::threading::ThreadData structure that contains GC's thread specific data.
 
         Any \p cds::threading::Manager implementation is a singleton and it must be accessible from any thread and from any point of
         your application. Note that you should not mix different implementation of the \p cds::threading::Manager in your application.
@@ -54,10 +82,10 @@ namespace cds {
         \code
         class Manager {
         public:
-            // Initialize manager (called by cds::Initialize() )
+            // Initialize manager (called by cds::Initialize())
             static void init();
 
-            // Terminate manager (called by cds::Terminate() )
+            // Terminate manager (called by cds::Terminate())
             static void fini();
 
             // Checks whether current thread is attached to \p libcds feature or not.
@@ -151,12 +179,12 @@ namespace cds {
                 , m_nFakeProcessorNumber( s_nLastUsedProcNo.fetch_add(1, atomics::memory_order_relaxed) % s_nProcCount )
                 , m_nAttachCount(0)
             {
-                if (cds::gc::HP::isUsed() )
+                if (cds::gc::HP::isUsed())
                     m_hpManager = new (m_hpManagerPlaceholder) cds::gc::HP::thread_gc_impl;
                 else
                     m_hpManager = nullptr;
 
-                if ( cds::gc::DHP::isUsed() )
+                if ( cds::gc::DHP::isUsed())
                     m_dhpManager = new (m_dhpManagerPlaceholder) cds::gc::DHP::thread_gc_impl;
                 else
                     m_dhpManager = nullptr;
@@ -188,21 +216,21 @@ namespace cds {
             void init()
             {
                 if ( m_nAttachCount++ == 0 ) {
-                    if ( cds::gc::HP::isUsed() )
+                    if ( cds::gc::HP::isUsed())
                         m_hpManager->init();
-                    if ( cds::gc::DHP::isUsed() )
+                    if ( cds::gc::DHP::isUsed())
                         m_dhpManager->init();
 
-                    if ( cds::urcu::details::singleton<cds::urcu::general_instant_tag>::isUsed() )
+                    if ( cds::urcu::details::singleton<cds::urcu::general_instant_tag>::isUsed())
                         m_pGPIRCU = cds::urcu::details::singleton<cds::urcu::general_instant_tag>::attach_thread();
-                    if ( cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::isUsed() )
+                    if ( cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::isUsed())
                         m_pGPBRCU = cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::attach_thread();
-                    if ( cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::isUsed() )
+                    if ( cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::isUsed())
                         m_pGPTRCU = cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::attach_thread();
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-                    if ( cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::isUsed() )
+                    if ( cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::isUsed())
                         m_pSHBRCU = cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::attach_thread();
-                    if ( cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::isUsed() )
+                    if ( cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::isUsed())
                         m_pSHTRCU = cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::attach_thread();
 #endif
                 }
@@ -211,29 +239,29 @@ namespace cds {
             bool fini()
             {
                 if ( --m_nAttachCount == 0 ) {
-                    if ( cds::gc::DHP::isUsed() )
+                    if ( cds::gc::DHP::isUsed())
                         m_dhpManager->fini();
-                    if ( cds::gc::HP::isUsed() )
+                    if ( cds::gc::HP::isUsed())
                         m_hpManager->fini();
 
-                    if ( cds::urcu::details::singleton<cds::urcu::general_instant_tag>::isUsed() ) {
+                    if ( cds::urcu::details::singleton<cds::urcu::general_instant_tag>::isUsed()) {
                         cds::urcu::details::singleton<cds::urcu::general_instant_tag>::detach_thread( m_pGPIRCU );
                         m_pGPIRCU = nullptr;
                     }
-                    if ( cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::isUsed() ) {
+                    if ( cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::isUsed()) {
                         cds::urcu::details::singleton<cds::urcu::general_buffered_tag>::detach_thread( m_pGPBRCU );
                         m_pGPBRCU = nullptr;
                     }
-                    if ( cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::isUsed() ) {
+                    if ( cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::isUsed()) {
                         cds::urcu::details::singleton<cds::urcu::general_threaded_tag>::detach_thread( m_pGPTRCU );
                         m_pGPTRCU = nullptr;
                     }
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
-                    if ( cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::isUsed() ) {
+                    if ( cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::isUsed()) {
                         cds::urcu::details::singleton<cds::urcu::signal_buffered_tag>::detach_thread( m_pSHBRCU );
                         m_pSHBRCU = nullptr;
                     }
-                    if ( cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::isUsed() ) {
+                    if ( cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::isUsed()) {
                         cds::urcu::details::singleton<cds::urcu::signal_threaded_tag>::detach_thread( m_pSHTRCU );
                         m_pSHTRCU = nullptr;
                     }
@@ -254,4 +282,4 @@ namespace cds {
     } // namespace threading
 } // namespace cds::threading
 
-#endif // #ifndef __CDS_THREADING__COMMON_H
+#endif // #ifndef CDSLIB_THREADING__COMMON_H