3 #ifndef __CDS_GC_IMPL_HP_IMPL_H
4 #define __CDS_GC_IMPL_HP_IMPL_H
6 #include <cds/threading/model.h>
7 #include <cds/details/static_functor.h>
10 namespace cds { namespace gc {
14 : m_hp( cds::threading::getGC<HP>().allocGuard() )
18 inline guard::guard( T * p )
19 : m_hp( cds::threading::getGC<HP>().allocGuard() )
24 inline guard::~guard()
26 cds::threading::getGC<HP>().freeGuard( m_hp );
29 template <size_t Count>
30 inline array<Count>::array()
32 cds::threading::getGC<HP>().allocGuard( *this );
35 template <size_t Count>
36 inline array<Count>::~array()
38 cds::threading::getGC<HP>().freeGuard( *this );
45 inline HP::thread_gc::thread_gc(
48 : m_bPersistent( bPersistent )
50 if ( !threading::Manager::isThreadAttached() )
51 threading::Manager::attachThread();
54 inline HP::thread_gc::~thread_gc()
57 cds::threading::Manager::detachThread();
60 inline /*static*/ cds::gc::hp::details::hp_guard& HP::thread_gc::alloc_guard()
62 return cds::threading::getGC<HP>().allocGuard();
65 inline /*static*/ void HP::thread_gc::free_guard( cds::gc::hp::details::hp_guard& g )
67 cds::threading::getGC<HP>().freeGuard( g );
71 inline void HP::retire( T * p, void (* pFunc)(T *) )
73 cds::threading::getGC<HP>().retirePtr( p, pFunc );
76 template <class Disposer, typename T>
77 inline void HP::retire( T * p )
79 cds::threading::getGC<HP>().retirePtr( p, cds::details::static_functor<Disposer, T>::call );
82 inline void HP::scan()
84 cds::threading::getGC<HP>().scan();
87 }} // namespace cds::gc
90 #endif // #ifndef __CDS_GC_IMPL_HP_IMPL_H