Removed redundant spaces
[libcds.git] / cds / gc / impl / dhp_impl.h
index a051e8698cf41899ce6ab8a0ebfa465741f727b8..70a68df77baadb58dc9b5a75c82d7c91308aa39d 100644 (file)
@@ -5,7 +5,7 @@
 
     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:
 
@@ -25,7 +25,7 @@
     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.     
+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
 #ifndef CDSLIB_GC_IMPL_DHP_IMPL_H
@@ -38,27 +38,32 @@ namespace cds { namespace gc {
 
     namespace dhp {
 
-        inline Guard::Guard()
-        {
-            cds::threading::getGC<DHP>().allocGuard( *this );
-        }
-
-        inline Guard::~Guard()
+        static inline ThreadGC& get_thread_gc()
         {
-            cds::threading::getGC<DHP>().freeGuard( *this );
+            return cds::threading::getGC<DHP>();
         }
 
-        template <size_t Count>
-        inline GuardArray<Count>::GuardArray()
-        {
-            cds::threading::getGC<DHP>().allocGuard( *this );
-        }
-
-        template <size_t Count>
-        inline GuardArray<Count>::~GuardArray()
-        {
-            cds::threading::getGC<DHP>().freeGuard( *this );
-        }
+        //inline Guard::Guard()
+        //{
+        //    cds::threading::getGC<DHP>().allocGuard( *this );
+        //}
+
+        //inline Guard::~Guard()
+        //{
+        //    cds::threading::getGC<DHP>().freeGuard( *this );
+        //}
+
+        //template <size_t Count>
+        //inline GuardArray<Count>::GuardArray()
+        //{
+        //    cds::threading::getGC<DHP>().allocGuard( *this );
+        //}
+
+        //template <size_t Count>
+        //inline GuardArray<Count>::~GuardArray()
+        //{
+        //    cds::threading::getGC<DHP>().freeGuard( *this );
+        //}
     } // namespace dhp
 
 
@@ -67,7 +72,7 @@ namespace cds { namespace gc {
         )
         : m_bPersistent( bPersistent )
     {
-        if ( !cds::threading::Manager::isThreadAttached() )
+        if ( !cds::threading::Manager::isThreadAttached())
             cds::threading::Manager::attachThread();
     }
 
@@ -77,13 +82,26 @@ namespace cds { namespace gc {
             cds::threading::Manager::detachThread();
     }
 
-    inline /*static*/ void DHP::thread_gc::alloc_guard( cds::gc::dhp::details::guard& g )
+    inline /*static*/ dhp::details::guard_data* DHP::thread_gc::alloc_guard()
+    {
+        return dhp::get_thread_gc().allocGuard();
+    }
+    inline /*static*/ void DHP::thread_gc::free_guard( dhp::details::guard_data* g )
     {
-        return cds::threading::getGC<DHP>().allocGuard(g);
+        if ( g )
+            dhp::get_thread_gc().freeGuard( g );
     }
-    inline /*static*/ void DHP::thread_gc::free_guard( cds::gc::dhp::details::guard& g )
+
+    template <size_t Count>
+    inline DHP::GuardArray<Count>::GuardArray()
+    {
+        dhp::get_thread_gc().allocGuard( m_arr );
+    }
+
+    template <size_t Count>
+    inline DHP::GuardArray<Count>::~GuardArray()
     {
-        cds::threading::getGC<DHP>().freeGuard(g);
+        dhp::get_thread_gc().freeGuard( m_arr );
     }
 
     inline void DHP::scan()