From a2087932f3f3d7e67320e2ec58fb529aa112940f Mon Sep 17 00:00:00 2001 From: khizmax Date: Wed, 1 Oct 2014 17:40:17 +0400 Subject: [PATCH] Remove cds/details/noncopyable.h, use C++11 '=delete ctor' instead --- cds/details/noncopyable.h | 15 --------------- cds/gc/hrc/hrc.h | 7 ++++--- cds/gc/hzp/hzp.h | 10 +++++----- cds/gc/ptb/ptb.h | 14 ++++++++++---- cds/lock/spinlock.h | 2 -- projects/Win/vc12/cds.vcxproj | 1 - projects/Win/vc12/cds.vcxproj.filters | 3 --- 7 files changed, 19 insertions(+), 33 deletions(-) delete mode 100644 cds/details/noncopyable.h diff --git a/cds/details/noncopyable.h b/cds/details/noncopyable.h deleted file mode 100644 index c2983a9a..00000000 --- a/cds/details/noncopyable.h +++ /dev/null @@ -1,15 +0,0 @@ -//$$CDS-header$$ - -#ifndef __CDS_DETAILS_NONCOPYABLE_H -#define __CDS_DETAILS_NONCOPYABLE_H - -#include - -//@cond -namespace cds { namespace details { - using boost::noncopyable; -}} // namespace cds::details -//@endcond - -#endif // __CDS_DETAILS_NONCOPYABLE_H - diff --git a/cds/gc/hrc/hrc.h b/cds/gc/hrc/hrc.h index 96cb1606..4ba20e74 100644 --- a/cds/gc/hrc/hrc.h +++ b/cds/gc/hrc/hrc.h @@ -17,8 +17,6 @@ #include -#include - #if CDS_COMPILER == CDS_COMPILER_MSVC # pragma warning(push) // warning C4251: 'cds::gc::hzp::GarbageCollector::m_pListHead' : class 'cds::cxx11_atomic::atomic' @@ -463,7 +461,7 @@ namespace cds { namespace gc { on the start of each thread that uses HRC GC. Before terminating the thread linked to HRC GC it is necessary to call cds::threading \p Manager::detachThread(). */ - class ThreadGC: cds::details::noncopyable + class ThreadGC { GarbageCollector& m_gc ; ///< master garbage collector details::thread_descriptor * m_pDesc ; ///< descriptor of GC data for the thread @@ -476,6 +474,9 @@ namespace cds { namespace gc { : m_gc( GarbageCollector::instance() ) , m_pDesc( nullptr ) {} + + ThreadGC( ThreadGC const& ) = delete; + ~ThreadGC() { fini(); diff --git a/cds/gc/hzp/hzp.h b/cds/gc/hzp/hzp.h index 92eb84d3..26cf409a 100644 --- a/cds/gc/hzp/hzp.h +++ b/cds/gc/hzp/hzp.h @@ -3,17 +3,14 @@ #ifndef __CDS_GC_HZP_HZP_H #define __CDS_GC_HZP_HZP_H +#include #include #include #include - #include #include #include -#include -#include - #if CDS_COMPILER == CDS_COMPILER_MSVC # pragma warning(push) // warning C4251: 'cds::gc::hzp::GarbageCollector::m_pListHead' : class 'cds::cxx11_atomic::atomic' @@ -459,7 +456,7 @@ namespace cds { on the start of each thread that uses HP GC. Before terminating the thread linked to HP GC it is necessary to call \ref cds_threading "cds::threading::Manager::detachThread()". */ - class ThreadGC: cds::details::noncopyable + class ThreadGC { GarbageCollector& m_HzpManager ; ///< Hazard Pointer GC singleton details::HPRec * m_pHzpRec ; ///< Pointer to thread's HZP record @@ -469,6 +466,9 @@ namespace cds { : m_HzpManager( GarbageCollector::instance() ), m_pHzpRec( nullptr ) {} + + ThreadGC( ThreadGC const& ) = delete; + ~ThreadGC() { fini(); diff --git a/cds/gc/ptb/ptb.h b/cds/gc/ptb/ptb.h index 7cb31de6..6605f928 100644 --- a/cds/gc/ptb/ptb.h +++ b/cds/gc/ptb/ptb.h @@ -8,7 +8,6 @@ #include #include #include -#include #include #if CDS_COMPILER == CDS_COMPILER_MSVC @@ -487,7 +486,7 @@ namespace cds { namespace gc { }; /// Uninitialized guard - class guard: public cds::details::noncopyable + class guard { friend class ThreadGC; protected: @@ -498,6 +497,8 @@ namespace cds { namespace gc { : m_pGuard( nullptr ) {} + guard( guard const& ) = delete; + /// Object destructor, does nothing ~guard() {} @@ -610,7 +611,7 @@ namespace cds { namespace gc { dtor returns the guards allocated back to the pool. */ template - class GuardArray: public cds::details::noncopyable + class GuardArray { details::guard m_arr[Count] ; ///< array of guard ThreadGC& m_gc ; ///< ThreadGC object of current thread @@ -627,6 +628,9 @@ namespace cds { namespace gc { /// Allocates array of guards from \p gc which must be the ThreadGC object of current thread GuardArray( ThreadGC& gc ) ; // inline below + GuardArray() = delete; + GuardArray( GuardArray const& ) = delete; + /// Returns guards allocated back to pool ~GuardArray() ; // inline below @@ -888,7 +892,7 @@ namespace cds { namespace gc { \li Free guard list: the list of thread-local free guards (linked by \p pNextFree field) Free guard list is a subset of thread guard list. */ - class ThreadGC: public cds::details::noncopyable + class ThreadGC { GarbageCollector& m_gc ; ///< reference to GC singleton details::guard_data * m_pList ; ///< Local list of guards owned by the thread @@ -901,6 +905,8 @@ namespace cds { namespace gc { , m_pFree( nullptr ) {} + ThreadGC( ThreadGC const& ) = delete; + /// Dtor calls fini() ~ThreadGC() { diff --git a/cds/lock/spinlock.h b/cds/lock/spinlock.h index 37842a53..0219eee8 100644 --- a/cds/lock/spinlock.h +++ b/cds/lock/spinlock.h @@ -16,8 +16,6 @@ #include #include -#include - namespace cds { /// Synchronization primitives namespace lock { diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 1a36281a..4312558e 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -829,7 +829,6 @@ - diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index f4b36afd..1721d882 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -239,9 +239,6 @@ Header Files\cds\details - - Header Files\cds\details - Header Files\cds\details -- 2.34.1