Improving gc:HP and gc::DHP guards
[libcds.git] / cds / gc / impl / dhp_impl.h
index 5028d93caa922167c2d91476e53ea5b2240bfb14..52fca6bf0908d8b9a4c26198c3bda5c98b7a9503 100644 (file)
@@ -8,6 +8,32 @@
 //@cond
 namespace cds { namespace gc {
 
+    namespace dhp {
+
+        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
+
+
     inline DHP::thread_gc::thread_gc(
         bool    bPersistent
         )
@@ -32,15 +58,6 @@ namespace cds { namespace gc {
         cds::threading::getGC<DHP>().freeGuard(g);
     }
 
-    inline DHP::Guard::Guard()
-        : Guard::base_class( cds::threading::getGC<DHP>() )
-    {}
-
-    template <size_t Count>
-    inline DHP::GuardArray<Count>::GuardArray()
-        : GuardArray::base_class( cds::threading::getGC<DHP>() )
-    {}
-
     inline void DHP::scan()
     {
         cds::threading::getGC<DHP>().scan();