From: khizmax Date: Sat, 31 Jan 2015 13:57:28 +0000 (+0300) Subject: rename cds::lock namespace to cds::sync, move corresponding .h files X-Git-Tag: v2.1.0~311 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=e5a7366d7fd32c9d0d540e094a7810120c31856c;p=libcds.git rename cds::lock namespace to cds::sync, move corresponding .h files Conflicts: projects/Win/vc12/cds.vcxproj.filters --- diff --git a/cds/algo/flat_combining.h b/cds/algo/flat_combining.h index 19fc20bd..4bacda83 100644 --- a/cds/algo/flat_combining.h +++ b/cds/algo/flat_combining.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include // thread_specific_ptr @@ -184,7 +184,7 @@ namespace cds { namespace algo { */ struct traits { - typedef cds::lock::Spin lock_type; ///< Lock type + typedef cds::sync::spin lock_type; ///< Lock type typedef cds::backoff::delay_of<2> back_off; ///< Back-off strategy typedef CDS_DEFAULT_ALLOCATOR allocator; ///< Allocator used for TLS data (allocating publication_record derivatives) typedef empty_stat stat; ///< Internal statistics @@ -194,7 +194,7 @@ namespace cds { namespace algo { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::delay_of<2> - \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR - \p opt::stat - internal statistics, possible type: \ref stat, \ref empty_stat (the default) diff --git a/cds/container/details/lazy_list_base.h b/cds/container/details/lazy_list_base.h index 583c72f0..1d671fbb 100644 --- a/cds/container/details/lazy_list_base.h +++ b/cds/container/details/lazy_list_base.h @@ -36,9 +36,9 @@ namespace cds { namespace container { /// Lock type used to lock modifying items /** - Default is cds::lock::Spin + Default is cds::sync::spin */ - typedef cds::lock::Spin lock_type; + typedef cds::sync::spin lock_type; /// back-off strategy used typedef cds::backoff::Default back_off; @@ -70,7 +70,7 @@ namespace cds { namespace container { /// Metafunction converting option list to \p lazy_list::traits /** \p Options are: - - \p opt::lock_type - lock type for node-level locking. Default \p is cds::lock::Spin. Note that each node + - \p opt::lock_type - lock type for node-level locking. Default \p is cds::sync::spin. Note that each node of the list has member of type \p lock_type, therefore, heavy-weighted locking primitive is not acceptable as candidate for \p lock_type. - \p opt::compare - key compare functor. No default functor is provided. diff --git a/cds/container/fcdeque.h b/cds/container/fcdeque.h index 481ee425..02af3fa2 100644 --- a/cds/container/fcdeque.h +++ b/cds/container/fcdeque.h @@ -66,7 +66,7 @@ namespace cds { namespace container { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::delay_of<2> - \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR - \p opt::stat - internal statistics, possible type: \ref stat, \ref empty_stat (the default) diff --git a/cds/container/fcpriority_queue.h b/cds/container/fcpriority_queue.h index 9707ce04..37c40fe0 100644 --- a/cds/container/fcpriority_queue.h +++ b/cds/container/fcpriority_queue.h @@ -52,7 +52,7 @@ namespace cds { namespace container { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::delay_of<2> - \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR - \p opt::stat - internal statistics, possible type: \p fcpqueue::stat, \p fcpqueue::empty_stat (the default) diff --git a/cds/container/fcqueue.h b/cds/container/fcqueue.h index f0694878..16cf213a 100644 --- a/cds/container/fcqueue.h +++ b/cds/container/fcqueue.h @@ -56,7 +56,7 @@ namespace cds { namespace container { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::delay_of<2> - \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR - \p opt::stat - internal statistics, possible type: \p fcqueue::stat, \p fcqueue::empty_stat (the default) diff --git a/cds/container/fcstack.h b/cds/container/fcstack.h index 0dbf5a8f..9319e164 100644 --- a/cds/container/fcstack.h +++ b/cds/container/fcstack.h @@ -56,7 +56,7 @@ namespace cds { namespace container { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::Default - \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR - \p opt::stat - internal statistics, possible type: \p fcstack::stat, \p fcstack::empty_stat (the default) diff --git a/cds/container/mspriority_queue.h b/cds/container/mspriority_queue.h index 1bc48565..a99c8193 100644 --- a/cds/container/mspriority_queue.h +++ b/cds/container/mspriority_queue.h @@ -55,7 +55,7 @@ namespace cds { namespace container { - \p opt::compare - priority compare functor. No default functor is provided. If the option is not specified, the \p opt::less is used. - \p opt::less - specifies binary predicate used for priority compare. Default is \p std::less. - - \p opt::lock_type - lock type. Default is \p cds::lock::Spin. + - \p opt::lock_type - lock type. Default is \p cds::sync::spin. - \p opt::back_off - back-off strategy. Default is \p cds::backoff::yield - \p opt::allocator - allocator (like \p std::allocator) for the values of queue's items. Default is \ref CDS_DEFAULT_ALLOCATOR diff --git a/cds/container/rwqueue.h b/cds/container/rwqueue.h index 55185f81..1ecdcf7a 100644 --- a/cds/container/rwqueue.h +++ b/cds/container/rwqueue.h @@ -5,7 +5,7 @@ #include // unique_lock #include -#include +#include namespace cds { namespace container { /// RWQueue related definitions @@ -16,7 +16,7 @@ namespace cds { namespace container { struct traits { /// Lock policy - typedef cds::lock::Spin lock_type; + typedef cds::sync::spin lock_type; /// Node allocator typedef CDS_DEFAULT_ALLOCATOR allocator; @@ -31,7 +31,7 @@ namespace cds { namespace container { /// Metafunction converting option list to \p rwqueue::traits /** Supported \p Options are: - - opt::lock_type - lock policy, default is \p cds::lock::Spin. Any type satisfied \p Mutex C++ concept may be used. + - opt::lock_type - lock policy, default is \p cds::sync::spin. Any type satisfied \p Mutex C++ concept may be used. - opt::allocator - allocator (like \p std::allocator) used for allocating queue nodes. Default is \ref CDS_DEFAULT_ALLOCATOR - opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter (item counting disabled) To enable item counting use \p cds::atomicity::item_counter. diff --git a/cds/container/segmented_queue.h b/cds/container/segmented_queue.h index 69361eec..3fc05271 100644 --- a/cds/container/segmented_queue.h +++ b/cds/container/segmented_queue.h @@ -55,7 +55,7 @@ namespace cds { namespace container { typedef CDS_DEFAULT_ALLOCATOR allocator; /// Lock type used to maintain an internal list of allocated segments - typedef cds::lock::Spin lock_type; + typedef cds::sync::spin lock_type; /// Random \ref cds::opt::permutation_generator "permutation generator" for sequence [0, quasi_factor) typedef cds::opt::v::random2_permutation permutation_generator; diff --git a/cds/container/treiber_stack.h b/cds/container/treiber_stack.h index d79e1f5b..1f8c93f2 100644 --- a/cds/container/treiber_stack.h +++ b/cds/container/treiber_stack.h @@ -69,8 +69,8 @@ namespace cds { namespace container { /// Random engine to generate a random position in elimination array typedef opt::v::c_rand random_engine; - /// Lock type used in elimination, default is cds::lock::Spin - typedef cds::lock::Spin lock_type; + /// Lock type used in elimination, default is cds::sync::spin + typedef cds::sync::spin lock_type; ///@} }; @@ -97,7 +97,7 @@ namespace cds { namespace container { - opt::random_engine - a random engine to generate a random position in elimination array. Default is \p opt::v::c_rand. - opt::elimination_backoff - back-off strategy to wait for elimination, default is \p cds::backoff::delay<> - - opt::lock_type - a lock type used in elimination back-off, default is \p cds::lock::Spin. + - opt::lock_type - a lock type used in elimination back-off, default is \p cds::sync::spin. Example: declare %TreiberStack with item counting and internal statistics using \p %make_traits \code diff --git a/cds/gc/details/dhp.h b/cds/gc/details/dhp.h index 58981ef9..9931e7d7 100644 --- a/cds/gc/details/dhp.h +++ b/cds/gc/details/dhp.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #if CDS_COMPILER == CDS_COMPILER_MSVC # pragma warning(push) @@ -96,9 +96,9 @@ namespace cds { namespace gc { { cds::details::Allocator m_GuardAllocator ; ///< guard allocator - atomics::atomic m_GuardList ; ///< Head of allocated guard list (linked by guard_data::pGlobalNext field) - atomics::atomic m_FreeGuardList ; ///< Head of free guard list (linked by guard_data::pNextFree field) - SpinLock m_freeListLock ; ///< Access to m_FreeGuardList + atomics::atomic m_GuardList; ///< Head of allocated guard list (linked by guard_data::pGlobalNext field) + atomics::atomic m_FreeGuardList; ///< Head of free guard list (linked by guard_data::pNextFree field) + cds::sync::spin m_freeListLock; ///< Access to m_FreeGuardList /* Unfortunately, access to the list of free guard is lock-based. @@ -151,7 +151,7 @@ namespace cds { namespace gc { details::guard_data * pGuard; { - std::unique_lock al( m_freeListLock ); + std::unique_lock al( m_freeListLock ); pGuard = m_FreeGuardList.load(atomics::memory_order_relaxed); if ( pGuard ) m_FreeGuardList.store( pGuard->pNextFree.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed ); @@ -171,7 +171,7 @@ namespace cds { namespace gc { { pGuard->pPost.store( nullptr, atomics::memory_order_relaxed ); - std::unique_lock al( m_freeListLock ); + std::unique_lock al( m_freeListLock ); pGuard->pNextFree.store( m_FreeGuardList.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed ); m_FreeGuardList.store( pGuard, atomics::memory_order_relaxed ); } @@ -223,7 +223,7 @@ namespace cds { namespace gc { pLast = p; } - std::unique_lock al( m_freeListLock ); + std::unique_lock al( m_freeListLock ); pLast->pNextFree.store( m_FreeGuardList.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed ); m_FreeGuardList.store( pList, atomics::memory_order_relaxed ); } diff --git a/cds/intrusive/cuckoo_set.h b/cds/intrusive/cuckoo_set.h index c4be8d7a..ab65aa2f 100644 --- a/cds/intrusive/cuckoo_set.h +++ b/cds/intrusive/cuckoo_set.h @@ -12,7 +12,7 @@ #include #include #include -#include +#include namespace cds { namespace intrusive { @@ -648,7 +648,7 @@ namespace cds { namespace intrusive { typedef unsigned long long owner_t; typedef cds::OS::ThreadId threadId_t; - typedef cds::lock::Spin spinlock_type; + typedef cds::sync::spin spinlock_type; typedef std::unique_lock< spinlock_type > scoped_spinlock; //@endcond diff --git a/cds/intrusive/details/lazy_list_base.h b/cds/intrusive/details/lazy_list_base.h index c8339342..26b9ef95 100644 --- a/cds/intrusive/details/lazy_list_base.h +++ b/cds/intrusive/details/lazy_list_base.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include namespace cds { namespace intrusive { @@ -20,12 +20,12 @@ namespace cds { namespace intrusive { /** Template parameters: - GC - garbage collector - - Lock - lock type. Default is \p cds::lock::Spin + - Lock - lock type. Default is \p cds::sync::spin - Tag - a \ref cds_intrusive_hook_tag "tag" */ template < class GC - ,typename Lock = cds::lock::Spin + ,typename Lock = cds::sync::spin ,typename Tag = opt::none > struct node @@ -68,7 +68,7 @@ namespace cds { namespace intrusive { struct default_hook { typedef undefined_gc gc; typedef opt::none tag; - typedef lock::Spin lock_type; + typedef sync::spin lock_type; }; //@endcond @@ -89,7 +89,7 @@ namespace cds { namespace intrusive { /** \p Options are: - opt::gc - garbage collector - - opt::lock_type - lock type used for node locking. Default is lock::Spin + - opt::lock_type - lock type used for node locking. Default is sync::spin - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template < typename... Options > @@ -103,7 +103,7 @@ namespace cds { namespace intrusive { \p Options are: - opt::gc - garbage collector - - opt::lock_type - lock type used for node locking. Default is lock::Spin + - opt::lock_type - lock type used for node locking. Default is sync::spin - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template < size_t MemberOffset, typename... Options > @@ -121,7 +121,7 @@ namespace cds { namespace intrusive { \p Options are: - opt::gc - garbage collector used. - - opt::lock_type - lock type used for node locking. Default is lock::Spin + - opt::lock_type - lock type used for node locking. Default is sync::spin - opt::tag - a \ref cds_intrusive_hook_tag "tag" */ template diff --git a/cds/intrusive/fcqueue.h b/cds/intrusive/fcqueue.h index f076b63e..7cd81136 100644 --- a/cds/intrusive/fcqueue.h +++ b/cds/intrusive/fcqueue.h @@ -53,7 +53,7 @@ namespace cds { namespace intrusive { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::Default - \p opt::disposer - the functor used for dispose removed items. Default is \p opt::intrusive::v::empty_disposer. This option is used only in \p FCQueue::clear() function. diff --git a/cds/intrusive/fcstack.h b/cds/intrusive/fcstack.h index b372a4d9..7e9a0086 100644 --- a/cds/intrusive/fcstack.h +++ b/cds/intrusive/fcstack.h @@ -53,7 +53,7 @@ namespace cds { namespace intrusive { /// Metafunction converting option list to traits /** \p Options are: - - \p opt::lock_type - mutex type, default is \p cds::lock::Spin + - \p opt::lock_type - mutex type, default is \p cds::sync::spin - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::Default - \p opt::disposer - the functor used for dispose removed items. Default is \p opt::intrusive::v::empty_disposer. This option is used only in \p FCStack::clear() function. diff --git a/cds/intrusive/lazy_list_nogc.h b/cds/intrusive/lazy_list_nogc.h index 12d82851..c4456be3 100644 --- a/cds/intrusive/lazy_list_nogc.h +++ b/cds/intrusive/lazy_list_nogc.h @@ -12,12 +12,12 @@ namespace cds { namespace intrusive { /// Lazy list node for \p gc::nogc /** Template parameters: - - Lock - lock type. Default is \p cds::lock::Spin + - Lock - lock type. Default is \p cds::sync::spin - Tag - a \ref cds_intrusive_hook_tag "tag" */ template < #ifdef CDS_DOXYGEN_INVOKED - typename Lock = cds::lock::Spin, + typename Lock = cds::sync::spin, typename Tag = opt::none #else typename Lock, diff --git a/cds/intrusive/mspriority_queue.h b/cds/intrusive/mspriority_queue.h index eca32914..405d38e3 100644 --- a/cds/intrusive/mspriority_queue.h +++ b/cds/intrusive/mspriority_queue.h @@ -5,7 +5,7 @@ #include // std::unique_lock #include -#include +#include #include #include #include @@ -70,16 +70,16 @@ namespace cds { namespace intrusive { /** No default functor is provided. If the option is not specified, the \p less is used. */ - typedef opt::none compare; + typedef opt::none compare; /// Specifies binary predicate used for priority comparing. /** Default is \p std::less. */ - typedef opt::none less; + typedef opt::none less; /// Type of mutual-exclusion lock - typedef lock::Spin lock_type; + typedef cds::sync::spin lock_type; /// Back-off strategy typedef backoff::yield back_off; @@ -102,7 +102,7 @@ namespace cds { namespace intrusive { - \p opt::compare - priority compare functor. No default functor is provided. If the option is not specified, the \p opt::less is used. - \p opt::less - specifies binary predicate used for priority compare. Default is \p std::less. - - \p opt::lock_type - lock type. Default is \p cds::lock::Spin. + - \p opt::lock_type - lock type. Default is \p cds::sync::spin - \p opt::back_off - back-off strategy. Default is \p cds::backoff::yield - \p opt::stat - internal statistics. Available types: \p mspriority_queue::stat, \p mspriority_queue::empty_stat (the default, no overhead) */ diff --git a/cds/intrusive/segmented_queue.h b/cds/intrusive/segmented_queue.h index d10ab14b..b4913e95 100644 --- a/cds/intrusive/segmented_queue.h +++ b/cds/intrusive/segmented_queue.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include @@ -105,7 +105,7 @@ namespace cds { namespace intrusive { typedef CDS_DEFAULT_ALLOCATOR allocator; /// Lock type used to maintain an internal list of allocated segments - typedef cds::lock::Spin lock_type; + typedef cds::sync::spin lock_type; /// Random \ref cds::opt::permutation_generator "permutation generator" for sequence [0, quasi_factor) typedef cds::opt::v::random2_permutation permutation_generator; diff --git a/cds/intrusive/striped_set/striping_policy.h b/cds/intrusive/striped_set/striping_policy.h index 8404bde9..c0f9d807 100644 --- a/cds/intrusive/striped_set/striping_policy.h +++ b/cds/intrusive/striped_set/striping_policy.h @@ -7,7 +7,7 @@ #include #include #include -#include +#include namespace cds { namespace intrusive { namespace striped_set { @@ -144,7 +144,7 @@ namespace cds { namespace intrusive { namespace striped_set { typedef unsigned long long owner_t; typedef cds::OS::ThreadId threadId_t; - typedef cds::lock::Spin spinlock_type; + typedef cds::sync::spin spinlock_type; typedef std::unique_lock< spinlock_type > scoped_spinlock; //@endcond diff --git a/cds/intrusive/treiber_stack.h b/cds/intrusive/treiber_stack.h index 9ccaa87e..d4ee4e3b 100644 --- a/cds/intrusive/treiber_stack.h +++ b/cds/intrusive/treiber_stack.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include namespace cds { namespace intrusive { @@ -199,8 +199,8 @@ namespace cds { namespace intrusive { /// Random engine to generate a random position in elimination array typedef opt::v::c_rand random_engine; - /// Lock type used in elimination, default is cds::lock::Spin - typedef cds::lock::Spin lock_type; + /// Lock type used in elimination, default is cds::sync::spin + typedef cds::sync::spin lock_type; ///@} }; @@ -231,7 +231,7 @@ namespace cds { namespace intrusive { - opt::random_engine - a random engine to generate a random position in elimination array. Default is \p opt::v::c_rand. - opt::elimination_backoff - back-off strategy to wait for elimination, default is \p cds::backoff::delay<> - - opt::lock_type - a lock type used in elimination back-off, default is \p cds::lock::Spin. + - opt::lock_type - a lock type used in elimination back-off, default is \p cds::sync::spin Example: declare \p %TreiberStack with elimination enabled and internal statistics \code diff --git a/cds/lock/array.h b/cds/lock/array.h index 7901ebbb..4842582a 100644 --- a/cds/lock/array.h +++ b/cds/lock/array.h @@ -92,7 +92,7 @@ namespace cds { namespace lock { can be simultaneous. Template arguments: - - \p Lock - lock type, for example, \p std::mutex, \p cds::lock::Spinlock + - \p Lock - lock type, for example, \p std::mutex, \p cds::sync::spin_lock - \p SelectPolicy - array cell selection policy, the default is \ref mod_select_policy Available policies: \ref trivial_select_policy, \ref pow2_select_policy, \ref mod_select_policy. - \p Alloc - memory allocator for array diff --git a/cds/lock/spinlock.h b/cds/lock/spinlock.h index e9db002b..ee6ad258 100644 --- a/cds/lock/spinlock.h +++ b/cds/lock/spinlock.h @@ -3,354 +3,31 @@ #ifndef __CDS_LOCK_SPINLOCK_H #define __CDS_LOCK_SPINLOCK_H -/* - Defines spin-lock primitives - Editions: - 2012.01.23 1.1.0 khizmax Refactoring: use C++11 atomics - 2010.01.22 0.6.0 khizmax Refactoring: use cds::atomic namespace - Explicit memory ordering specification (atomic::memory_order_xxx) - 2006 khizmax Created -*/ +#warning "cds/lock/spinlock.h is deprecated, use cds/sync/spinlock.h instead" -#include -#include -#include +#include +//@cond namespace cds { - /// Synchronization primitives + /// Synchronization primitives (deprecated namespace, use \p cds::sync namespace instead) namespace lock { - /// Spin lock. - /** - Simple and light-weight spin-lock critical section - It is useful to gain access to small (short-timed) code - Algorithm: - - TATAS (test-and-test-and-lock) - [1984] L. Rudolph, Z. Segall. Dynamic Decentralized Cache Schemes for MIMD Parallel Processors. - - No serialization performed - any of waiting threads may owns the spin-lock. - This spin-lock is NOT recursive: the thread owned the lock cannot call lock() method withod deadlock. - The method unlock() can call any thread - - DEBUG version: The spinlock stores owner thead id. Assertion is raised when: - - double lock attempt encountered by same thread (deadlock) - - unlock by another thread - - If spin-lock is locked the Backoff algorithm is called. Predefined backoff::LockDefault class yields current - thread and repeats lock attempts later - - Template parameters: - - @p Backoff backoff strategy. Used when spin lock is locked - */ - template - class Spinlock - { - public: - typedef Backoff backoff_strategy ; ///< back-off strategy type - private: - atomics::atomic m_spin ; ///< Spin -# ifdef CDS_DEBUG - typename OS::ThreadId m_dbgOwnerId ; ///< Owner thread id (only for debug mode) -# endif - - public: - /// Construct free (unlocked) spin-lock - Spinlock() CDS_NOEXCEPT -# ifdef CDS_DEBUG - :m_dbgOwnerId( OS::c_NullThreadId ) -# endif - { - m_spin.store( false, atomics::memory_order_relaxed ); - } - - /// Construct spin-lock in specified state - /** - In debug mode: if \p bLocked = true then spin-lock is made owned by current thread - */ - Spinlock( bool bLocked ) CDS_NOEXCEPT -# ifdef CDS_DEBUG - : m_dbgOwnerId( bLocked ? OS::get_current_thread_id() : OS::c_NullThreadId ) -# endif - { - m_spin.store( bLocked, atomics::memory_order_relaxed ); - } - - /// Dummy copy constructor - /** - In theory, spin-lock cannot be copied. However, it is not practical. - Therefore, we provide dummy copy constructor that do no copy in fact. The ctor - initializes the spin to free (unlocked) state like default ctor. - */ - Spinlock(const Spinlock& ) CDS_NOEXCEPT - : m_spin( false ) -# ifdef CDS_DEBUG - , m_dbgOwnerId( OS::c_NullThreadId ) -# endif - {} - - /// Destructor. On debug time it checks whether spin-lock is free - ~Spinlock() - { - assert( !m_spin.load( atomics::memory_order_relaxed ) ); - } - - /// Check if the spin is locked - bool is_locked() const CDS_NOEXCEPT - { - return m_spin.load( atomics::memory_order_relaxed ); - } - - /// Try to lock the object - /** - Returns \p true if locking is succeeded - otherwise (if the spin is already locked) returns \p false - - Debug version: deadlock can be detected - */ - bool try_lock() CDS_NOEXCEPT - { - bool bCurrent = false; - m_spin.compare_exchange_strong( bCurrent, true, atomics::memory_order_acquire, atomics::memory_order_relaxed ); - - CDS_DEBUG_ONLY( - if ( !bCurrent ) { - m_dbgOwnerId = OS::get_current_thread_id(); - } - ) - return !bCurrent; - } - - /// Try to lock the object, repeat @p nTryCount times if failed - /** - Returns \p true if locking is succeeded - otherwise (if the spin is already locked) returns \p false - */ - bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() ) ) - { - backoff_strategy backoff; - while ( nTryCount-- ) { - if ( try_lock() ) - return true; - backoff(); - } - return false; - } - - /// Lock the spin-lock. Waits infinitely while spin-lock is locked. Debug version: deadlock may be detected - void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()() )) - { - backoff_strategy backoff; - - // Deadlock detected - assert( m_dbgOwnerId != OS::get_current_thread_id() ); - - // TATAS algorithm - while ( !try_lock() ) { - while ( m_spin.load( atomics::memory_order_relaxed ) ) { - backoff(); - } - } - assert( m_dbgOwnerId == OS::get_current_thread_id() ); - } - - /// Unlock the spin-lock. Debug version: deadlock may be detected - void unlock() CDS_NOEXCEPT - { - assert( m_spin.load( atomics::memory_order_relaxed ) ); - - assert( m_dbgOwnerId == OS::get_current_thread_id() ); - CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; ) - - m_spin.store( false, atomics::memory_order_release ); - } - }; + /// Alias for \p cds::sync::spin_lock for backward compatibility + template + using Spinlock = cds::sync::spin_lock< Backoff >; /// Spin-lock implementation default for the current platform - typedef Spinlock Spin; + typedef cds::sync::spin_lock< backoff::LockDefault> Spin; - /// Recursive spin lock. - /** - Allows recursive calls: the owner thread may recursive enter to critical section guarded by the spin-lock. - - Template parameters: - - @p Integral one of integral atomic type: unsigned int, int, and others - - @p Backoff backoff strategy. Used when spin lock is locked - */ + /// Alias for \p cds::sync::reentrant_spin_lock for backward compatibility template - class ReentrantSpinT - { - typedef OS::ThreadId thread_id ; ///< The type of thread id - - public: - typedef Integral integral_type ; ///< The integral type - typedef Backoff backoff_strategy ; ///< The backoff type - - private: - atomics::atomic m_spin ; ///< spin-lock atomic - thread_id m_OwnerId ; ///< Owner thread id. If spin-lock is not locked it usually equals to OS::c_NullThreadId - - private: - //@cond - void take( thread_id tid ) CDS_NOEXCEPT - { - m_OwnerId = tid; - } - - void free() CDS_NOEXCEPT - { - m_OwnerId = OS::c_NullThreadId; - } - - bool is_taken( thread_id tid ) const CDS_NOEXCEPT - { - return m_OwnerId == tid; - } - - bool try_taken_lock( thread_id tid ) CDS_NOEXCEPT - { - if ( is_taken( tid )) { - m_spin.fetch_add( 1, atomics::memory_order_relaxed ); - return true; - } - return false; - } - - bool try_acquire() CDS_NOEXCEPT - { - integral_type nCurrent = 0; - return m_spin.compare_exchange_weak( nCurrent, 1, atomics::memory_order_acquire, atomics::memory_order_relaxed ); - } - - bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) - { - backoff_strategy bkoff; - - while ( nTryCount-- ) { - if ( try_acquire() ) - return true; - bkoff(); - } - return false; - } - - void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) - { - // TATAS algorithm - backoff_strategy bkoff; - while ( !try_acquire() ) { - while ( m_spin.load( atomics::memory_order_relaxed ) ) - bkoff(); - } - } - //@endcond - - public: - /// Default constructor initializes spin to free (unlocked) state - ReentrantSpinT() CDS_NOEXCEPT - : m_spin(0) - , m_OwnerId( OS::c_NullThreadId ) - {} - - /// Dummy copy constructor - /** - In theory, spin-lock cannot be copied. However, it is not practical. - Therefore, we provide dummy copy constructor that do no copy in fact. The ctor - initializes the spin to free (unlocked) state like default ctor. - */ - ReentrantSpinT(const ReentrantSpinT& ) CDS_NOEXCEPT - : m_spin(0) - , m_OwnerId( OS::c_NullThreadId ) - {} - - /// Construct object for specified state - ReentrantSpinT(bool bLocked) CDS_NOEXCEPT - : m_spin(0) - , m_OwnerId( OS::c_NullThreadId ) - { - if ( bLocked ) - lock(); - } - - /// Checks if the spin is locked - /** - The spin is locked if lock count > 0 and the current thread is not an owner of the lock. - Otherwise (i.e. lock count == 0 or the curren thread owns the spin) the spin is unlocked. - */ - bool is_locked() const CDS_NOEXCEPT - { - return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id() )); - } - - /// Try to lock the spin-lock (synonym for \ref try_lock) - bool try_lock() CDS_NOEXCEPT - { - thread_id tid = OS::get_current_thread_id(); - if ( try_taken_lock( tid ) ) - return true; - if ( try_acquire()) { - take( tid ); - return true; - } - return false; - } - - /// Try to lock the object - bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( try_acquire( nTryCount ) ) ) - { - thread_id tid = OS::get_current_thread_id(); - if ( try_taken_lock( tid ) ) - return true; - if ( try_acquire( nTryCount )) { - take( tid ); - return true; - } - return false; - } - - /// Lock the object waits if it is busy - void lock() CDS_NOEXCEPT - { - thread_id tid = OS::get_current_thread_id(); - if ( !try_taken_lock( tid ) ) { - acquire(); - take( tid ); - } - } - - /// Unlock the spin-lock. Return @p true if the current thread is owner of spin-lock @p false otherwise - bool unlock() CDS_NOEXCEPT - { - if ( is_taken( OS::get_current_thread_id() ) ) { - integral_type n = m_spin.load( atomics::memory_order_relaxed ); - if ( n > 1 ) - m_spin.store( n - 1, atomics::memory_order_relaxed ); - else { - free(); - m_spin.store( 0, atomics::memory_order_release ); - } - return true; - } - return false; - } - - /// Change the owner of locked spin-lock. May be called by thread that is owner of the spin-lock - bool change_owner( OS::ThreadId newOwnerId ) CDS_NOEXCEPT - { - if ( is_taken( OS::get_current_thread_id() ) ) { - assert( newOwnerId != OS::c_NullThreadId ); - m_OwnerId = newOwnerId; - return true; - } - return false; - } - }; + using ReentrantSpinT = cds::sync::reentrant_spin_lock< Integral, Backoff >; /// Recursive 32bit spin-lock - typedef ReentrantSpinT ReentrantSpin32; + typedef cds::sync::reentrant_spin32 ReentrantSpin32; /// Recursive 64bit spin-lock - typedef ReentrantSpinT ReentrantSpin64; + typedef cds::sync::reentrant_spin64 ReentrantSpin64; /// Default recursive spin-lock type typedef ReentrantSpin32 ReentrantSpin; @@ -370,5 +47,6 @@ namespace cds { typedef lock::ReentrantSpin64 RecursiveSpinLock64; } // namespace cds +//@endcond #endif // #ifndef __CDS_LOCK_SPINLOCK_H diff --git a/cds/memory/michael/allocator.h b/cds/memory/michael/allocator.h index 08a738a3..bc30dd1f 100644 --- a/cds/memory/michael/allocator.h +++ b/cds/memory/michael/allocator.h @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include #include @@ -703,8 +703,8 @@ namespace michael { typedef page_cached_allocator<> page_heap; typedef aligned_malloc_heap aligned_heap; typedef default_sizeclass_selector sizeclass_selector; - typedef free_list_locked free_list; - typedef partial_list_locked partial_list; + typedef free_list_locked free_list; + typedef partial_list_locked partial_list; typedef procheap_empty_stat procheap_stat; typedef os_allocated_empty os_allocated_stat; typedef cds::opt::none check_bounds; diff --git a/cds/opt/options.h b/cds/opt/options.h index 7b9c3d85..6645adaf 100644 --- a/cds/opt/options.h +++ b/cds/opt/options.h @@ -50,11 +50,11 @@ namespace opt { Examples: \code - // default_spin is cds::lock::Spin - typedef typename cds::opt::select_default< cds::opt::none, cds::lock::Spin >::type default_spin; + // default_spin is cds::sync::spin + typedef typename cds::opt::select_default< cds::opt::none, cds::sync::spin >::type default_spin; - // spin_32bit is cds::lock::Spin32 - typedef typename cds::opt::select_default< cds::lock::Spin32, cds::lock::Spin >::type spin_32bit; + // spin_32bit is cds::sync::reentrant_spin32 + typedef typename cds::opt::select_default< cds::lock::Spin32, cds::sync::reentrant_spin32 >::type spin_32bit; \endcode */ template diff --git a/cds/sync/injected_monitor.h b/cds/sync/injected_monitor.h new file mode 100644 index 00000000..4626e7ca --- /dev/null +++ b/cds/sync/injected_monitor.h @@ -0,0 +1,68 @@ +//$$CDS-header$$ + +#ifndef CDSLIB_LOCK_INJECTED_MONITOR_H +#define CDSLIB_LOCK_INJECTED_MONITOR_H + +namespace cds { namespace lock { + + /// Monitor that injects a lock as a member into a class + /** + Template arguments: + - Lock - lock type like \p std::mutex or \p cds::sync::spin + */ + template + class injected_monitor + { + public: + typedef Lock lock_type; + + template + struct wrapper : public T + { + using T::T; + mutable lock_type m_Lock; + + void lock() const + { + m_Lock.lock; + } + + void unlock() const + { + m_Lock.unlock(); + } + }; + + template + void lock( T const& p ) const + { + p.lock(); + } + + template + void unlock( T const& p ) const + { + p.unlock(); + } + + template + class scoped_lock + { + T const& m_Locked; + + public: + scoped_lock( injected_monitor const&, T const& p ) + : m_Locked( p ) + { + p.lock(); + } + + ~scoped_lock() + { + p.unlock(); + } + }; + }; +}} // namespace cds::lock + +#endif // #ifndef CDSLIB_LOCK_INJECTED_MONITOR_H diff --git a/cds/sync/spinlock.h b/cds/sync/spinlock.h new file mode 100644 index 00000000..753fe07e --- /dev/null +++ b/cds/sync/spinlock.h @@ -0,0 +1,351 @@ +//$$CDS-header$$-2 + +#ifndef CDSLIB_SYNC_SPINLOCK_H +#define CDSLIB_SYNC_SPINLOCK_H + +#include +#include +#include + +namespace cds { + /// Synchronization primitives + namespace sync { + /// Spin lock + /** + Simple and light-weight spin-lock critical section + It is useful to gain access to small (short-timed) code + + Algorithm: + + TATAS (test-and-test-and-lock) + [1984] L. Rudolph, Z. Segall. Dynamic Decentralized Cache Schemes for MIMD Parallel Processors. + + No serialization performed - any of waiting threads may owns the spin-lock. + This spin-lock is NOT recursive: the thread owned the lock cannot call lock() method withod deadlock. + The method unlock() can call any thread + + DEBUG version: The spinlock stores owner thead id. Assertion is raised when: + - double lock attempt encountered by same thread (deadlock) + - unlock by another thread + + If spin-lock is locked the Backoff algorithm is called. Predefined backoff::LockDefault class yields current + thread and repeats lock attempts later + + Template parameters: + - @p Backoff backoff strategy. Used when spin lock is locked + */ + template + class spin_lock + { + public: + typedef Backoff backoff_strategy; ///< back-off strategy type + private: + atomics::atomic m_spin; ///< Spin +# ifdef CDS_DEBUG + typename OS::ThreadId m_dbgOwnerId; ///< Owner thread id (only for debug mode) +# endif + + public: + /// Construct free (unlocked) spin-lock + spin_lock() CDS_NOEXCEPT +# ifdef CDS_DEBUG + :m_dbgOwnerId( OS::c_NullThreadId ) +# endif + { + m_spin.store( false, atomics::memory_order_relaxed ); + } + + /// Construct spin-lock in specified state + /** + In debug mode: if \p bLocked = true then spin-lock is made owned by current thread + */ + spin_lock( bool bLocked ) CDS_NOEXCEPT +# ifdef CDS_DEBUG + : m_dbgOwnerId( bLocked ? cds::OS::get_current_thread_id() : cds::OS::c_NullThreadId ) +# endif + { + m_spin.store( bLocked, atomics::memory_order_relaxed ); + } + + /// Dummy copy constructor + /** + In theory, spin-lock cannot be copied. However, it is not practical. + Therefore, we provide dummy copy constructor that do no copy in fact. The ctor + initializes the spin to free (unlocked) state like default ctor. + */ + spin_lock(const spin_lock& ) CDS_NOEXCEPT + : m_spin( false ) +# ifdef CDS_DEBUG + , m_dbgOwnerId( cds::OS::c_NullThreadId ) +# endif + {} + + /// Destructor. On debug time it checks whether spin-lock is free + ~spin_lock() + { + assert( !m_spin.load( atomics::memory_order_relaxed ) ); + } + + /// Check if the spin is locked + bool is_locked() const CDS_NOEXCEPT + { + return m_spin.load( atomics::memory_order_relaxed ); + } + + /// Try to lock the object + /** + Returns \p true if locking is succeeded + otherwise (if the spin is already locked) returns \p false + + Debug version: deadlock can be detected + */ + bool try_lock() CDS_NOEXCEPT + { + bool bCurrent = false; + m_spin.compare_exchange_strong( bCurrent, true, atomics::memory_order_acquire, atomics::memory_order_relaxed ); + + CDS_DEBUG_ONLY( + if ( !bCurrent ) { + m_dbgOwnerId = OS::get_current_thread_id(); + } + ) + return !bCurrent; + } + + /// Try to lock the object, repeat @p nTryCount times if failed + /** + Returns \p true if locking is succeeded + otherwise (if the spin is already locked) returns \p false + */ + bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() ) ) + { + backoff_strategy backoff; + while ( nTryCount-- ) { + if ( try_lock() ) + return true; + backoff(); + } + return false; + } + + /// Lock the spin-lock. Waits infinitely while spin-lock is locked. Debug version: deadlock may be detected + void lock() CDS_NOEXCEPT_(noexcept( backoff_strategy()() )) + { + backoff_strategy backoff; + + // Deadlock detected + assert( m_dbgOwnerId != OS::get_current_thread_id() ); + + // TATAS algorithm + while ( !try_lock() ) { + while ( m_spin.load( atomics::memory_order_relaxed ) ) { + backoff(); + } + } + assert( m_dbgOwnerId == OS::get_current_thread_id() ); + } + + /// Unlock the spin-lock. Debug version: deadlock may be detected + void unlock() CDS_NOEXCEPT + { + assert( m_spin.load( atomics::memory_order_relaxed ) ); + + assert( m_dbgOwnerId == OS::get_current_thread_id() ); + CDS_DEBUG_ONLY( m_dbgOwnerId = OS::c_NullThreadId; ) + + m_spin.store( false, atomics::memory_order_release ); + } + }; + + /// Spin-lock implementation default for the current platform + typedef spin_lock spin; + + /// Recursive spin lock. + /** + Allows recursive calls: the owner thread may recursive enter to critical section guarded by the spin-lock. + + Template parameters: + - @p Integral one of integral atomic type: unsigned int, int, and others + - @p Backoff backoff strategy. Used when spin lock is locked + */ + template + class reentrant_spin_lock + { + typedef OS::ThreadId thread_id ; ///< The type of thread id + + public: + typedef Integral integral_type ; ///< The integral type + typedef Backoff backoff_strategy ; ///< The backoff type + + private: + atomics::atomic m_spin ; ///< spin-lock atomic + thread_id m_OwnerId ; ///< Owner thread id. If spin-lock is not locked it usually equals to OS::c_NullThreadId + + private: + //@cond + void take( thread_id tid ) CDS_NOEXCEPT + { + m_OwnerId = tid; + } + + void free() CDS_NOEXCEPT + { + m_OwnerId = OS::c_NullThreadId; + } + + bool is_taken( thread_id tid ) const CDS_NOEXCEPT + { + return m_OwnerId == tid; + } + + bool try_taken_lock( thread_id tid ) CDS_NOEXCEPT + { + if ( is_taken( tid )) { + m_spin.fetch_add( 1, atomics::memory_order_relaxed ); + return true; + } + return false; + } + + bool try_acquire() CDS_NOEXCEPT + { + integral_type nCurrent = 0; + return m_spin.compare_exchange_weak( nCurrent, 1, atomics::memory_order_acquire, atomics::memory_order_relaxed ); + } + + bool try_acquire( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) + { + backoff_strategy bkoff; + + while ( nTryCount-- ) { + if ( try_acquire() ) + return true; + bkoff(); + } + return false; + } + + void acquire() CDS_NOEXCEPT_( noexcept( backoff_strategy()() )) + { + // TATAS algorithm + backoff_strategy bkoff; + while ( !try_acquire() ) { + while ( m_spin.load( atomics::memory_order_relaxed ) ) + bkoff(); + } + } + //@endcond + + public: + /// Default constructor initializes spin to free (unlocked) state + reentrant_spin_lock() CDS_NOEXCEPT + : m_spin(0) + , m_OwnerId( OS::c_NullThreadId ) + {} + + /// Dummy copy constructor + /** + In theory, spin-lock cannot be copied. However, it is not practical. + Therefore, we provide dummy copy constructor that do no copy in fact. The ctor + initializes the spin to free (unlocked) state like default ctor. + */ + reentrant_spin_lock( const reentrant_spin_lock& ) CDS_NOEXCEPT + : m_spin(0) + , m_OwnerId( OS::c_NullThreadId ) + {} + + /// Construct object for specified state + reentrant_spin_lock( bool bLocked ) CDS_NOEXCEPT + : m_spin(0) + , m_OwnerId( OS::c_NullThreadId ) + { + if ( bLocked ) + lock(); + } + + /// Checks if the spin is locked + /** + The spin is locked if lock count > 0 and the current thread is not an owner of the lock. + Otherwise (i.e. lock count == 0 or the curren thread owns the spin) the spin is unlocked. + */ + bool is_locked() const CDS_NOEXCEPT + { + return !( m_spin.load( atomics::memory_order_relaxed ) == 0 || is_taken( cds::OS::get_current_thread_id() )); + } + + /// Try to lock the spin-lock (synonym for \ref try_lock) + bool try_lock() CDS_NOEXCEPT + { + thread_id tid = OS::get_current_thread_id(); + if ( try_taken_lock( tid ) ) + return true; + if ( try_acquire()) { + take( tid ); + return true; + } + return false; + } + + /// Try to lock the object + bool try_lock( unsigned int nTryCount ) CDS_NOEXCEPT_( noexcept( try_acquire( nTryCount ) ) ) + { + thread_id tid = OS::get_current_thread_id(); + if ( try_taken_lock( tid ) ) + return true; + if ( try_acquire( nTryCount )) { + take( tid ); + return true; + } + return false; + } + + /// Lock the object waits if it is busy + void lock() CDS_NOEXCEPT + { + thread_id tid = OS::get_current_thread_id(); + if ( !try_taken_lock( tid ) ) { + acquire(); + take( tid ); + } + } + + /// Unlock the spin-lock. Return @p true if the current thread is owner of spin-lock @p false otherwise + bool unlock() CDS_NOEXCEPT + { + if ( is_taken( OS::get_current_thread_id() ) ) { + integral_type n = m_spin.load( atomics::memory_order_relaxed ); + if ( n > 1 ) + m_spin.store( n - 1, atomics::memory_order_relaxed ); + else { + free(); + m_spin.store( 0, atomics::memory_order_release ); + } + return true; + } + return false; + } + + /// Change the owner of locked spin-lock. May be called by thread that is owner of the spin-lock + bool change_owner( OS::ThreadId newOwnerId ) CDS_NOEXCEPT + { + if ( is_taken( OS::get_current_thread_id() ) ) { + assert( newOwnerId != OS::c_NullThreadId ); + m_OwnerId = newOwnerId; + return true; + } + return false; + } + }; + + /// Recursive 32bit spin-lock + typedef reentrant_spin_lock reentrant_spin32; + + /// Default recursive spin-lock + typedef reentrant_spin32 reentrant_spin; + + /// Recursive 64bit spin-lock + typedef reentrant_spin_lock reentrant_spin64; + } // namespace sync +} // namespace cds + +#endif // #ifndef CDSLIB_SYNC_SPINLOCK_H diff --git a/change.log b/change.log index 3aebf3a1..a9869939 100644 --- a/change.log +++ b/change.log @@ -1,5 +1,8 @@ 2.1.0 - TODO + - cds::lock namespace is renamed to cds::sync. All classes defined in cds::lock namespace + are moved to cds::sync with new names (for example, cds::lock::SpinLock is renamed to + cds::sync::spin_lock). cds::lock namespace and its contents is deprecated and it is kept + for backward compatibility. 2.0.0 30.12.2014 General release diff --git a/projects/Win/vc12/cds.vcxproj b/projects/Win/vc12/cds.vcxproj index 3dd82f60..0bdfd121 100644 --- a/projects/Win/vc12/cds.vcxproj +++ b/projects/Win/vc12/cds.vcxproj @@ -793,6 +793,8 @@ + + diff --git a/projects/Win/vc12/cds.vcxproj.filters b/projects/Win/vc12/cds.vcxproj.filters index 6b52bf20..5cbefad1 100644 --- a/projects/Win/vc12/cds.vcxproj.filters +++ b/projects/Win/vc12/cds.vcxproj.filters @@ -151,6 +151,9 @@ {3195cce2-1710-4b79-a1cf-6c7cea085fa3} + + {03d212fb-73f8-4f0e-9aff-f22b0783fee8} + @@ -1163,5 +1166,11 @@ Header Files\cds\algo + + Header Files\cds\sync + + + Header Files\cds\sync + \ No newline at end of file diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_boost_flat_map.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_boost_flat_map.cpp index 146fde57..60a981ad 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_boost_flat_map.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_boost_flat_map.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< map_t - ,co::mutex_policy< cc::striped_set::refinable > + ,co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_boost_list.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_boost_list.cpp index 4668c6be..d2f31c1e 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_boost_list.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_boost_list.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + ,co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_boost_map.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_boost_map.cpp index 350ec625..49a2afaf 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_boost_map.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_boost_map.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< map_t - ,co::mutex_policy< cc::striped_set::refinable > + ,co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_boost_unordered_map.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_boost_unordered_map.cpp index 1e18fb96..b96eb81e 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_boost_unordered_map.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_boost_unordered_map.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -50,7 +50,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< map_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_hashmap_std.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_hashmap_std.cpp index d3e06c03..047f4789 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_hashmap_std.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_hashmap_std.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include #if !((CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER < 1600) @@ -52,7 +52,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< map_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_list.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_list.cpp index a8ff667e..33f031a9 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_list.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_list.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -50,7 +50,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_map.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_map.cpp index 93adb939..c98b2f7c 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_map.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_map.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -50,7 +50,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< map_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_refinable_hashmap_slist.cpp b/tests/test-hdr/map/hdr_refinable_hashmap_slist.cpp index 48d5f717..e0aaa6d6 100644 --- a/tests/test-hdr/map/hdr_refinable_hashmap_slist.cpp +++ b/tests/test-hdr/map/hdr_refinable_hashmap_slist.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -64,7 +64,7 @@ namespace map { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedMap< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > map_spin; diff --git a/tests/test-hdr/map/hdr_striped_hashmap_boost_flat_map.cpp b/tests/test-hdr/map/hdr_striped_hashmap_boost_flat_map.cpp index 842c500b..69c700db 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_boost_flat_map.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_boost_flat_map.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { typedef cc::StripedMap< map_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_boost_list.cpp b/tests/test-hdr/map/hdr_striped_hashmap_boost_list.cpp index a33e1fbc..ec562543 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_boost_list.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_boost_list.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { typedef cc::StripedMap< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped2< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_boost_map.cpp b/tests/test-hdr/map/hdr_striped_hashmap_boost_map.cpp index a8089996..39e28526 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_boost_map.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_boost_map.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { typedef cc::StripedMap< map_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_boost_unordered_map.cpp b/tests/test-hdr/map/hdr_striped_hashmap_boost_unordered_map.cpp index 412fca14..9437b80a 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_boost_unordered_map.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_boost_unordered_map.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -50,7 +50,7 @@ namespace map { typedef cc::StripedMap< map_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_hashmap_std.cpp b/tests/test-hdr/map/hdr_striped_hashmap_hashmap_std.cpp index 95ca7221..dd933a38 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_hashmap_std.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_hashmap_std.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include #if !((CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER < 1600) @@ -52,7 +52,7 @@ namespace map { typedef cc::StripedMap< map_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_list.cpp b/tests/test-hdr/map/hdr_striped_hashmap_list.cpp index b71ede24..2cd2f487 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_list.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_list.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -51,7 +51,7 @@ namespace map { typedef cc::StripedMap< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped2< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_map.cpp b/tests/test-hdr/map/hdr_striped_hashmap_map.cpp index 1a3e4794..a9902218 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_map.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_map.cpp @@ -3,7 +3,7 @@ #include "map/hdr_striped_map.h" #include #include -#include +#include namespace map { @@ -50,7 +50,7 @@ namespace map { typedef cc::StripedMap< map_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped< map_spin >(); diff --git a/tests/test-hdr/map/hdr_striped_hashmap_slist.cpp b/tests/test-hdr/map/hdr_striped_hashmap_slist.cpp index 170faaa8..309f1db6 100644 --- a/tests/test-hdr/map/hdr_striped_hashmap_slist.cpp +++ b/tests/test-hdr/map/hdr_striped_hashmap_slist.cpp @@ -16,7 +16,7 @@ namespace map { #include #include -#include +#include namespace map { @@ -63,7 +63,7 @@ namespace map { typedef cc::StripedMap< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping > + , co::mutex_policy< cc::striped_set::striping > > map_spin; test_striped2< map_spin >(); diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_flat_set.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_flat_set.cpp index 4fa1ddb5..374942c1 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_flat_set.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_flat_set.cpp @@ -17,7 +17,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -64,7 +64,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< set_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_list.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_list.cpp index f0012814..4f56162e 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_list.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_list.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -64,7 +64,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_set.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_set.cpp index b0cb7294..e268434b 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_set.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_set.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -63,7 +63,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< set_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_stable_vector.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_stable_vector.cpp index c6dfd908..5d3d316a 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_stable_vector.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_stable_vector.cpp @@ -17,7 +17,7 @@ namespace set { #include #include #include -#include +#include namespace set { @@ -65,7 +65,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_unordered_set.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_unordered_set.cpp index 42713b99..042a2fc6 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_unordered_set.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_unordered_set.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -59,7 +59,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< set_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_boost_vector.cpp b/tests/test-hdr/set/hdr_refinable_hashset_boost_vector.cpp index e006c73d..3983c124 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_boost_vector.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_boost_vector.cpp @@ -18,7 +18,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -66,7 +66,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_hashset_std.cpp b/tests/test-hdr/set/hdr_refinable_hashset_hashset_std.cpp index 9d7d1ac1..aa367105 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_hashset_std.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_hashset_std.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include #if !((CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER < 1600) @@ -61,7 +61,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< set_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_list.cpp b/tests/test-hdr/set/hdr_refinable_hashset_list.cpp index cdba9423..e5ba93ba 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_list.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_list.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -51,7 +51,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_set.cpp b/tests/test-hdr/set/hdr_refinable_hashset_set.cpp index 7acf7ad4..94139bf7 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_set.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_set.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -51,7 +51,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< set_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_slist.cpp b/tests/test-hdr/set/hdr_refinable_hashset_slist.cpp index 23499c8f..be9772ed 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_slist.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_slist.cpp @@ -15,7 +15,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -63,7 +63,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_refinable_hashset_vector.cpp b/tests/test-hdr/set/hdr_refinable_hashset_vector.cpp index bd912994..0622c14d 100644 --- a/tests/test-hdr/set/hdr_refinable_hashset_vector.cpp +++ b/tests/test-hdr/set/hdr_refinable_hashset_vector.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -51,7 +51,7 @@ namespace set { // Spinlock as lock policy CPPUNIT_MESSAGE( "spinlock"); typedef cc::StripedSet< sequence_t - ,co::mutex_policy< cc::striped_set::refinable > + , co::mutex_policy< cc::striped_set::refinable > , co::hash< hash_int > , co::less< less > > set_spin; diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_flat_set.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_flat_set.cpp index eaaf0c79..f004f2ba 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_flat_set.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_flat_set.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -63,7 +63,7 @@ namespace set { typedef cc::StripedSet< set_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + ,co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_list.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_list.cpp index 79521064..b8faaffc 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_list.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_list.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -62,7 +62,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_set.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_set.cpp index 4006e357..8c2a8883 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_set.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_set.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -65,7 +65,7 @@ namespace set { typedef cc::StripedSet< set_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_stable_vector.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_stable_vector.cpp index b1e9bc66..7fbdb608 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_stable_vector.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_stable_vector.cpp @@ -17,7 +17,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -67,7 +67,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_unordered_set.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_unordered_set.cpp index cad515b7..5262e012 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_unordered_set.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_unordered_set.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -61,7 +61,7 @@ namespace set { typedef cc::StripedSet< set_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_boost_vector.cpp b/tests/test-hdr/set/hdr_striped_hashset_boost_vector.cpp index ef0b9f91..38f13d15 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_boost_vector.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_boost_vector.cpp @@ -16,7 +16,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -66,7 +66,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_hashset_std.cpp b/tests/test-hdr/set/hdr_striped_hashset_hashset_std.cpp index 9f75a3c3..40527675 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_hashset_std.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_hashset_std.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include #if !((CDS_COMPILER == CDS_COMPILER_MSVC || (CDS_COMPILER == CDS_COMPILER_INTEL && CDS_OS_INTERFACE == CDS_OSI_WINDOWS)) && _MSC_VER < 1600) @@ -63,7 +63,7 @@ namespace set { typedef cc::StripedSet< set_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_list.cpp b/tests/test-hdr/set/hdr_striped_hashset_list.cpp index 432b5513..9b2e30bb 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_list.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_list.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -53,7 +53,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_set.cpp b/tests/test-hdr/set/hdr_striped_hashset_set.cpp index 5a58a390..4df0f9be 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_set.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_set.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -53,7 +53,7 @@ namespace set { typedef cc::StripedSet< set_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_slist.cpp b/tests/test-hdr/set/hdr_striped_hashset_slist.cpp index 68637a39..73ea1d41 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_slist.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_slist.cpp @@ -15,7 +15,7 @@ namespace set { #include #include -#include +#include namespace set { @@ -65,7 +65,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/test-hdr/set/hdr_striped_hashset_vector.cpp b/tests/test-hdr/set/hdr_striped_hashset_vector.cpp index 4fda502c..ea8100c8 100644 --- a/tests/test-hdr/set/hdr_striped_hashset_vector.cpp +++ b/tests/test-hdr/set/hdr_striped_hashset_vector.cpp @@ -3,7 +3,7 @@ #include "set/hdr_striped_set.h" #include #include -#include +#include namespace set { @@ -53,7 +53,7 @@ namespace set { typedef cc::StripedSet< sequence_t , co::hash< hash_int > , co::less< less > - ,co::mutex_policy< cc::striped_set::striping< cds::lock::Spin > > + , co::mutex_policy< cc::striped_set::striping< cds::sync::spin> > > set_spin; test_striped2< set_spin >(); diff --git a/tests/unit/alloc/random.cpp b/tests/unit/alloc/random.cpp index 3e6a6b41..9a60d83a 100644 --- a/tests/unit/alloc/random.cpp +++ b/tests/unit/alloc/random.cpp @@ -22,7 +22,7 @@ namespace memory { static size_t s_nPassPerThread; struct Item { - cds::SpinLock m_access; + cds::sync::spin m_access; char * m_pszBlock; Item() diff --git a/tests/unit/lock/spinlock.cpp b/tests/unit/lock/spinlock.cpp index bfaae2b3..aabbdb6f 100644 --- a/tests/unit/lock/spinlock.cpp +++ b/tests/unit/lock/spinlock.cpp @@ -93,21 +93,25 @@ namespace lock { } } - typedef cds::lock::Spinlock > Spinlock_exp; + typedef cds::sync::spin_lock > Spinlock_exp; - typedef cds::lock::ReentrantSpinT > reentrantSpin_exp; - typedef cds::lock::ReentrantSpinT reentrantSpin_yield; - typedef cds::lock::ReentrantSpinT reentrantSpin_hint; - typedef cds::lock::ReentrantSpinT reentrantSpin_empty; + typedef cds::sync::reentrant_spin_lock > reentrantSpin_exp; + typedef cds::sync::reentrant_spin_lock reentrantSpin_yield; + typedef cds::sync::reentrant_spin_lock reentrantSpin_hint; + typedef cds::sync::reentrant_spin_lock reentrantSpin_empty; TEST_CASE(spinLock_exp, Spinlock_exp ); - TEST_CASE(spinLock_yield, cds::lock::Spinlock ); - TEST_CASE(spinLock_hint, cds::lock::Spinlock ); - TEST_CASE(spinLock_empty, cds::lock::Spinlock ); - - TEST_CASE(reentrantSpinLock, cds::lock::ReentrantSpin ); - TEST_CASE(reentrantSpinLock32, cds::lock::ReentrantSpin32 ); - TEST_CASE(reentrantSpinLock64, cds::lock::ReentrantSpin64 ); + TEST_CASE(spinLock_yield, cds::sync::spin_lock ); + TEST_CASE(spinLock_hint, cds::sync::spin_lock ); + TEST_CASE(spinLock_empty, cds::sync::spin_lock ); + TEST_CASE( spinLock_yield_lock, cds::lock::Spinlock ); + TEST_CASE( spinLock_hint_lock, cds::lock::Spinlock ); + TEST_CASE( spinLock_empty_lock, cds::lock::Spinlock ); + + TEST_CASE( reentrantSpinLock32, cds::sync::reentrant_spin32 ); + TEST_CASE( reentrantSpinLock64, cds::sync::reentrant_spin64 ); + TEST_CASE( reentrantSpinLock32_lock, cds::lock::ReentrantSpin32 ); + TEST_CASE( reentrantSpinLock64_lock, cds::lock::ReentrantSpin64 ); TEST_CASE(reentrantSpinlock_exp, reentrantSpin_exp ); TEST_CASE(reentrantSpinlock_yield, reentrantSpin_yield ); @@ -121,7 +125,6 @@ namespace lock { CPPUNIT_TEST(spinLock_hint); CPPUNIT_TEST(spinLock_empty); - CPPUNIT_TEST(reentrantSpinLock); CPPUNIT_TEST(reentrantSpinLock32); CPPUNIT_TEST(reentrantSpinLock64); diff --git a/tests/unit/map2/map_insdel_func.cpp b/tests/unit/map2/map_insdel_func.cpp index aa09a1dd..365f2de7 100644 --- a/tests/unit/map2/map_insdel_func.cpp +++ b/tests/unit/map2/map_insdel_func.cpp @@ -5,7 +5,7 @@ #include "map2/map_types.h" #include "cppunit/thread.h" -#include +#include #include #include // random_shuffle @@ -36,7 +36,7 @@ namespace map2 { atomics::atomic bInitialized; cds::OS::ThreadId threadId ; // insert thread id - typedef cds::lock::Spinlock< cds::backoff::pause > lock_type; + typedef cds::sync::spin_lock< cds::backoff::pause > lock_type; mutable lock_type m_access; value_type() diff --git a/tests/unit/map2/map_types.h b/tests/unit/map2/map_types.h index 8a4c99a0..ff63de4e 100644 --- a/tests/unit/map2/map_types.h +++ b/tests/unit/map2/map_types.h @@ -51,7 +51,7 @@ #include #include -#include +#include #include "cppunit/cppunit_mini.h" #include "lock/nolock.h" @@ -1717,11 +1717,11 @@ namespace map2 { // *************************************************************************** // Standard implementations - typedef StdMap< Key, Value, cds::SpinLock > StdMap_Spin; - typedef StdMap< Key, Value, lock::NoLock> StdMap_NoLock; + typedef StdMap< Key, Value, cds::sync::spin > StdMap_Spin; + typedef StdMap< Key, Value, lock::NoLock> StdMap_NoLock; - typedef StdHashMap< Key, Value, cds::SpinLock > StdHashMap_Spin; - typedef StdHashMap< Key, Value, lock::NoLock > StdHashMap_NoLock; + typedef StdHashMap< Key, Value, cds::sync::spin > StdHashMap_Spin; + typedef StdHashMap< Key, Value, lock::NoLock > StdHashMap_NoLock; }; diff --git a/tests/unit/pqueue/pqueue_type.h b/tests/unit/pqueue/pqueue_type.h index 5c906140..fa8c9c42 100644 --- a/tests/unit/pqueue/pqueue_type.h +++ b/tests/unit/pqueue/pqueue_type.h @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "print_ellenbintree_stat.h" #include "print_skip_list_stat.h" @@ -280,9 +280,9 @@ namespace pqueue { > FCPQueue_boost_stable_vector_stat; /// Standard priority_queue - typedef StdPQueue< Value, std::vector, cds::lock::Spin > StdPQueue_vector_spin; + typedef StdPQueue< Value, std::vector, cds::sync::spin> StdPQueue_vector_spin; typedef StdPQueue< Value, std::vector, std::mutex > StdPQueue_vector_mutex; - typedef StdPQueue< Value, std::deque, cds::lock::Spin > StdPQueue_deque_spin; + typedef StdPQueue< Value, std::deque, cds::sync::spin> StdPQueue_deque_spin; typedef StdPQueue< Value, std::deque, std::mutex > StdPQueue_deque_mutex; }; diff --git a/tests/unit/queue/intrusive_queue_type.h b/tests/unit/queue/intrusive_queue_type.h index 97605ae3..d62ad233 100644 --- a/tests/unit/queue/intrusive_queue_type.h +++ b/tests/unit/queue/intrusive_queue_type.h @@ -463,8 +463,8 @@ namespace queue { typedef cds::intrusive::SegmentedQueue< cds::gc::DHP, T, traits_SegmentedQueue_mutex_stat > SegmentedQueue_DHP_mutex_stat; // Boost SList - typedef details::BoostSList< T, std::mutex > BoostSList_mutex; - typedef details::BoostSList< T, cds::lock::Spin > BoostSList_spin; + typedef details::BoostSList< T, std::mutex > BoostSList_mutex; + typedef details::BoostSList< T, cds::sync::spin > BoostSList_spin; }; } diff --git a/tests/unit/queue/std_queue.h b/tests/unit/queue/std_queue.h index 42935e36..5848ddc1 100644 --- a/tests/unit/queue/std_queue.h +++ b/tests/unit/queue/std_queue.h @@ -5,11 +5,11 @@ #include //unique_lock #include -#include +#include namespace queue { - template + template class StdQueue: public std::queue { typedef std::queue base_class; @@ -42,11 +42,11 @@ namespace queue { } }; - template + template class StdQueue_deque: public StdQueue, Lock > {}; - template + template class StdQueue_list: public StdQueue, Lock > {}; } diff --git a/tests/unit/set2/set_insdel_func.h b/tests/unit/set2/set_insdel_func.h index 6c75a97c..4d38066a 100644 --- a/tests/unit/set2/set_insdel_func.h +++ b/tests/unit/set2/set_insdel_func.h @@ -7,7 +7,7 @@ #include "set2/set_types.h" #include "cppunit/thread.h" -#include +#include namespace set2 { @@ -34,7 +34,7 @@ namespace set2 { bool volatile bInitialized; cds::OS::ThreadId threadId ; // insert thread id - typedef cds::lock::Spinlock< cds::backoff::pause > lock_type; + typedef cds::sync::spin_lock< cds::backoff::pause > lock_type; mutable lock_type m_access; value_type() diff --git a/tests/unit/set2/set_types.h b/tests/unit/set2/set_types.h index ea0c63cd..a048eb37 100644 --- a/tests/unit/set2/set_types.h +++ b/tests/unit/set2/set_types.h @@ -49,7 +49,7 @@ #endif #include -#include +#include #include #include "cppunit/cppunit_mini.h" @@ -1709,11 +1709,11 @@ namespace set2 { // *************************************************************************** // Standard implementations - typedef StdSet< key_val, less, cds::SpinLock > StdSet_Spin; - typedef StdSet< key_val, less, lock::NoLock> StdSet_NoLock; + typedef StdSet< key_val, less, cds::sync::spin > StdSet_Spin; + typedef StdSet< key_val, less, lock::NoLock> StdSet_NoLock; - typedef StdHashSet< key_val, hash, less, equal_to, cds::SpinLock > StdHashSet_Spin; - typedef StdHashSet< key_val, hash, less, equal_to, lock::NoLock > StdHashSet_NoLock; + typedef StdHashSet< key_val, hash, less, equal_to, cds::sync::spin > StdHashSet_Spin; + typedef StdHashSet< key_val, hash, less, equal_to, lock::NoLock > StdHashSet_NoLock; }; diff --git a/tests/unit/stack/intrusive_stack_type.h b/tests/unit/stack/intrusive_stack_type.h index 9898180d..cf447e1b 100644 --- a/tests/unit/stack/intrusive_stack_type.h +++ b/tests/unit/stack/intrusive_stack_type.h @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -337,11 +337,11 @@ namespace istack { // std::stack typedef details::StdStack< T, std::stack< T* >, std::mutex > StdStack_Deque_Mutex; - typedef details::StdStack< T, std::stack< T* >, cds::lock::Spin > StdStack_Deque_Spin; + typedef details::StdStack< T, std::stack< T* >, cds::sync::spin > StdStack_Deque_Spin; typedef details::StdStack< T, std::stack< T*, std::vector >, std::mutex > StdStack_Vector_Mutex; - typedef details::StdStack< T, std::stack< T*, std::vector >, cds::lock::Spin > StdStack_Vector_Spin; + typedef details::StdStack< T, std::stack< T*, std::vector >, cds::sync::spin > StdStack_Vector_Spin; typedef details::StdStack< T, std::stack< T*, std::list >, std::mutex > StdStack_List_Mutex; - typedef details::StdStack< T, std::stack< T*, std::list >, cds::lock::Spin > StdStack_List_Spin; + typedef details::StdStack< T, std::stack< T*, std::list >, cds::sync::spin > StdStack_List_Spin; }; } // namespace istack diff --git a/tests/unit/stack/stack_type.h b/tests/unit/stack/stack_type.h index e27622b6..076a88ce 100644 --- a/tests/unit/stack/stack_type.h +++ b/tests/unit/stack/stack_type.h @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -383,11 +383,11 @@ namespace stack { // std::stack typedef details::StdStack< T, std::stack< T >, std::mutex > StdStack_Deque_Mutex; - typedef details::StdStack< T, std::stack< T >, cds::lock::Spin > StdStack_Deque_Spin; + typedef details::StdStack< T, std::stack< T >, cds::sync::spin > StdStack_Deque_Spin; typedef details::StdStack< T, std::stack< T, std::vector >, std::mutex > StdStack_Vector_Mutex; - typedef details::StdStack< T, std::stack< T, std::vector >, cds::lock::Spin > StdStack_Vector_Spin; + typedef details::StdStack< T, std::stack< T, std::vector >, cds::sync::spin > StdStack_Vector_Spin; typedef details::StdStack< T, std::stack< T, std::list >, std::mutex > StdStack_List_Mutex; - typedef details::StdStack< T, std::stack< T, std::list >, cds::lock::Spin > StdStack_List_Spin; + typedef details::StdStack< T, std::stack< T, std::list >, cds::sync::spin > StdStack_List_Spin; }; } // namespace stack