Replace cds::lock::scoped_lock with std::unique_lock, remove cds/lock/scoped_lock.h
authorkhizmax <khizmax@gmail.com>
Wed, 1 Oct 2014 11:45:37 +0000 (15:45 +0400)
committerkhizmax <khizmax@gmail.com>
Wed, 1 Oct 2014 11:45:37 +0000 (15:45 +0400)
30 files changed:
cds/container/rwqueue.h
cds/gc/ptb/ptb.h
cds/intrusive/cuckoo_set.h
cds/intrusive/impl/lazy_list.h
cds/intrusive/lazy_list_nogc.h
cds/intrusive/lazy_list_rcu.h
cds/intrusive/striped_set/striping_policy.h
cds/intrusive/treiber_stack.h
cds/lock/array.h
cds/lock/scoped_lock.h [deleted file]
cds/lock/spinlock.h
cds/memory/michael/allocator.h
cds/urcu/details/gpb.h
cds/urcu/details/gpi.h
cds/urcu/details/gpt.h
cds/urcu/details/sig_buffered.h
cds/urcu/details/sig_threaded.h
projects/Win/vc12/cds.vcxproj
projects/Win/vc12/cds.vcxproj.filters
tests/unit/map2/map_insdel_func.cpp
tests/unit/map2/std_hash_map_gcc.h
tests/unit/map2/std_hash_map_vc.h
tests/unit/map2/std_map_gcc.h
tests/unit/map2/std_map_vc.h
tests/unit/pqueue/std_pqueue.h
tests/unit/queue/std_queue.h
tests/unit/set2/set_insdel_func.h
tests/unit/set2/std_hash_set_std.h
tests/unit/set2/std_hash_set_vc9.h
tests/unit/set2/std_set.h

index b63d2ad03cfe391c3a4e22c7592832eead9566ac..6754b6bcc23b4a098e9986b6ec9074436135b151 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <memory>
 #include <functional>   // ref
 
 #include <memory>
 #include <functional>   // ref
+#include <mutex>        // unique_lock
 #include <cds/opt/options.h>
 #include <cds/lock/spinlock.h>
 #include <cds/intrusive/details/queue_stat.h>
 #include <cds/opt/options.h>
 #include <cds/lock/spinlock.h>
 #include <cds/intrusive/details/queue_stat.h>
@@ -106,7 +107,7 @@ namespace cds { namespace container {
     protected:
         //@cond
         typedef typename opt::details::alignment_setter< lock_type, options::alignment >::type aligned_lock_type;
     protected:
         //@cond
         typedef typename opt::details::alignment_setter< lock_type, options::alignment >::type aligned_lock_type;
-        typedef cds::lock::scoped_lock<lock_type>   auto_lock;
+        typedef std::unique_lock<lock_type>   auto_lock;
         typedef cds::details::Allocator< node_type, allocator_type >  node_allocator;
 
         item_counter    m_ItemCounter;
         typedef cds::details::Allocator< node_type, allocator_type >  node_allocator;
 
         item_counter    m_ItemCounter;
index b4d716b22bb8ed26364b654bb1e264f7893a7285..7cb31de6a8e604e16daffb6c2ac61640913f77af 100644 (file)
@@ -3,12 +3,12 @@
 #ifndef __CDS_GC_PTB_PASS_THE_BUCK_H
 #define __CDS_GC_PTB_PASS_THE_BUCK_H
 
 #ifndef __CDS_GC_PTB_PASS_THE_BUCK_H
 #define __CDS_GC_PTB_PASS_THE_BUCK_H
 
+#include <mutex>        // unique_lock
 #include <cds/cxx11_atomic.h>
 #include <cds/gc/details/retired_ptr.h>
 #include <cds/details/aligned_allocator.h>
 #include <cds/details/allocator.h>
 #include <cds/details/noncopyable.h>
 #include <cds/cxx11_atomic.h>
 #include <cds/gc/details/retired_ptr.h>
 #include <cds/details/aligned_allocator.h>
 #include <cds/details/allocator.h>
 #include <cds/details/noncopyable.h>
-
 #include <cds/lock/spinlock.h>
 
 #if CDS_COMPILER == CDS_COMPILER_MSVC
 #include <cds/lock/spinlock.h>
 
 #if CDS_COMPILER == CDS_COMPILER_MSVC
@@ -173,7 +173,7 @@ namespace cds { namespace gc {
                     details::guard_data * pGuard;
 
                     {
                     details::guard_data * pGuard;
 
                     {
-                        cds::lock::scoped_lock<SpinLock> al( m_freeListLock );
+                        std::unique_lock<SpinLock> 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 );
                         pGuard = m_FreeGuardList.load(atomics::memory_order_relaxed);
                         if ( pGuard )
                             m_FreeGuardList.store( pGuard->pNextFree.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed );
@@ -193,7 +193,7 @@ namespace cds { namespace gc {
                 {
                     pGuard->pPost.store( nullptr, atomics::memory_order_relaxed );
 
                 {
                     pGuard->pPost.store( nullptr, atomics::memory_order_relaxed );
 
-                    cds::lock::scoped_lock<SpinLock> al( m_freeListLock );
+                    std::unique_lock<SpinLock> 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 );
                 }
                     pGuard->pNextFree.store( m_FreeGuardList.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed );
                     m_FreeGuardList.store( pGuard, atomics::memory_order_relaxed );
                 }
@@ -245,7 +245,7 @@ namespace cds { namespace gc {
                         pLast = p;
                     }
 
                         pLast = p;
                     }
 
-                    cds::lock::scoped_lock<SpinLock> al( m_freeListLock );
+                    std::unique_lock<SpinLock> 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 );
                 }
                     pLast->pNextFree.store( m_FreeGuardList.load(atomics::memory_order_relaxed), atomics::memory_order_relaxed );
                     m_FreeGuardList.store( pList, atomics::memory_order_relaxed );
                 }
index 2b42e7634b88eabd799b27118d9f786250963cb0..e54f8237df6a4ee819353105ff76b92fb488fd49 100644 (file)
@@ -391,9 +391,9 @@ namespace cds { namespace intrusive {
                 lock_array( size_t nCapacity ): lock_array_type( nCapacity, typename lock_array_type::select_cell_policy(nCapacity) ) {}
             };
 
                 lock_array( size_t nCapacity ): lock_array_type( nCapacity, typename lock_array_type::select_cell_policy(nCapacity) ) {}
             };
 
-            class scoped_lock: public cds::lock::scoped_lock< lock_array_type >
+            class scoped_lock: public std::unique_lock< lock_array_type >
             {
             {
-                typedef cds::lock::scoped_lock< lock_array_type > base_class;
+                typedef std::unique_lock< lock_array_type > base_class;
             public:
                 scoped_lock( lock_array& arrLock, size_t nHash ): base_class( arrLock, nHash ) {}
             };
             public:
                 scoped_lock( lock_array& arrLock, size_t nHash ): base_class( arrLock, nHash ) {}
             };
@@ -464,7 +464,7 @@ namespace cds { namespace intrusive {
             };
 
             class scoped_full_lock {
             };
 
             class scoped_full_lock {
-                cds::lock::scoped_lock< lock_array_type >   m_guard;
+                std::unique_lock< lock_array_type >   m_guard;
             public:
                 scoped_full_lock( striping& policy )
                     : m_guard( policy.m_Locks[0] )
             public:
                 scoped_full_lock( striping& policy )
                     : m_guard( policy.m_Locks[0] )
@@ -650,7 +650,7 @@ namespace cds { namespace intrusive {
             typedef cds::OS::ThreadId   threadId_t;
 
             typedef cds::lock::Spin     spinlock_type;
             typedef cds::OS::ThreadId   threadId_t;
 
             typedef cds::lock::Spin     spinlock_type;
-            typedef cds::lock::scoped_lock< spinlock_type > scoped_spinlock;
+            typedef std::unique_lock< spinlock_type > scoped_spinlock;
             //@endcond
 
         protected:
             //@endcond
 
         protected:
index c0d64a96baa0425ced5454a27c561675680a246a..4c30289250f4128090ec1e2c0f5775c75e686dd1 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef __CDS_INTRUSIVE_IMPL_LAZY_LIST_H
 #define __CDS_INTRUSIVE_IMPL_LAZY_LIST_H
 
 #ifndef __CDS_INTRUSIVE_IMPL_LAZY_LIST_H
 #define __CDS_INTRUSIVE_IMPL_LAZY_LIST_H
 
+#include <mutex>        // unique_lock
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/gc/guarded_ptr.h>
 
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/gc/guarded_ptr.h>
 
@@ -1126,7 +1127,7 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != tail() ) {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != tail() ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( !pos.pCur->is_marked()
                     && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                 if ( !pos.pCur->is_marked()
                     && cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
index a50e742a5608b183505f1e6a761caf87c6c12b71..e2b6f96ed5e147af0246a3ee7d89ac533496a2e6 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 #define __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 
 #ifndef __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 #define __CDS_INTRUSIVE_LAZY_LIST_NOGC_H
 
+#include <mutex>        // unique_lock
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/gc/nogc.h>
 
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/gc/nogc.h>
 
@@ -612,7 +613,7 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     f( *node_traits::to_value_ptr( *pos.pCur ), val );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     f( *node_traits::to_value_ptr( *pos.pCur ), val );
@@ -638,7 +639,7 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     return iterator( pos.pCur );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     return iterator( pos.pCur );
index 43ddce46c2239824115fa5c7398143825108b891..cc2acce56e3eac1a9b5b7f294babc32af3fa3a98 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef __CDS_INTRUSIVE_LAZY_LIST_RCU_H
 #define __CDS_INTRUSIVE_LAZY_LIST_RCU_H
 
 #ifndef __CDS_INTRUSIVE_LAZY_LIST_RCU_H
 #define __CDS_INTRUSIVE_LAZY_LIST_RCU_H
 
+#include <mutex>        // unique_lock
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/urcu/details/check_deadlock.h>
 #include <cds/details/binary_functor_wrapper.h>
 #include <cds/intrusive/details/lazy_list_base.h>
 #include <cds/urcu/details/check_deadlock.h>
 #include <cds/details/binary_functor_wrapper.h>
@@ -1105,7 +1106,7 @@ namespace cds { namespace intrusive {
             rcu_lock l( bLock );
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
             rcu_lock l( bLock );
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     f( *node_traits::to_value_ptr( *pos.pCur ), val );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     f( *node_traits::to_value_ptr( *pos.pCur ), val );
@@ -1131,7 +1132,7 @@ namespace cds { namespace intrusive {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
 
             search( pHead, val, pos, cmp );
             if ( pos.pCur != &m_Tail ) {
-                cds::lock::scoped_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
+                std::unique_lock< typename node_type::lock_type> al( pos.pCur->m_Lock );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     return const_iterator( pos.pCur );
                 if ( cmp( *node_traits::to_value_ptr( *pos.pCur ), val ) == 0 )
                 {
                     return const_iterator( pos.pCur );
index f37986012820a7bfde6b720a2d7f610b6d14fda1..a70858b9ac01f04cb9f6282259c424fed99a0a2f 100644 (file)
@@ -145,7 +145,7 @@ namespace cds { namespace intrusive { namespace striped_set {
         typedef cds::OS::ThreadId   threadId_t;
 
         typedef cds::lock::Spin     spinlock_type;
         typedef cds::OS::ThreadId   threadId_t;
 
         typedef cds::lock::Spin     spinlock_type;
-        typedef cds::lock::scoped_lock< spinlock_type > scoped_spinlock;
+        typedef std::unique_lock< spinlock_type > scoped_spinlock;
         //@endcond
 
     protected:
         //@endcond
 
     protected:
@@ -273,11 +273,11 @@ namespace cds { namespace intrusive { namespace striped_set {
     public:
         //@cond
         class scoped_cell_lock {
     public:
         //@cond
         class scoped_cell_lock {
-            cds::lock::scoped_lock< lock_type >   m_guard;
+            std::unique_lock< lock_type >   m_guard;
 
         public:
             scoped_cell_lock( refinable& policy, size_t nHash )
 
         public:
             scoped_cell_lock( refinable& policy, size_t nHash )
-                : m_guard( policy.acquire( nHash ), true )
+                : m_guard( policy.acquire( nHash ), std::adopt_lock_t() )
             {}
         };
 
             {}
         };
 
index 09b03c3edb8f16864c9ad97ead7d87bf9e30c69f..5e5083c10098fc55e34624495e2b25603d1d26c7 100644 (file)
@@ -5,11 +5,11 @@
 
 #include <type_traits>
 #include <functional>   // ref
 
 #include <type_traits>
 #include <functional>   // ref
+#include <mutex>        // unique_lock
 #include <cds/intrusive/details/single_link_struct.h>
 #include <cds/algo/elimination.h>
 #include <cds/opt/buffer.h>
 #include <cds/lock/spinlock.h>
 #include <cds/intrusive/details/single_link_struct.h>
 #include <cds/algo/elimination.h>
 #include <cds/opt/buffer.h>
 #include <cds/lock/spinlock.h>
-#include <cds/lock/scoped_lock.h>
 #include <cds/details/type_padding.h>
 
 namespace cds { namespace intrusive {
 #include <cds/details/type_padding.h>
 
 namespace cds { namespace intrusive {
@@ -183,7 +183,7 @@ namespace cds { namespace intrusive {
                     op_collided = 2
                 };
 
                     op_collided = 2
                 };
 
-                typedef cds::lock::scoped_lock< elimination_lock_type > slot_scoped_lock;
+                typedef std::unique_lock< elimination_lock_type > slot_scoped_lock;
 
             public:
                 elimination_backoff()
 
             public:
                 elimination_backoff()
index ce94189a51d01559e50bee06acbda83cbbe23e74..ff8db6b877557002f7f9a007dc5e77bbca866891 100644 (file)
@@ -3,10 +3,9 @@
 #ifndef __CDS_LOCK_ARRAY_H
 #define __CDS_LOCK_ARRAY_H
 
 #ifndef __CDS_LOCK_ARRAY_H
 #define __CDS_LOCK_ARRAY_H
 
+#include <mutex>    //unique_lock
 #include <cds/details/allocator.h>
 #include <cds/details/allocator.h>
-#include <cds/lock/scoped_lock.h>
 #include <cds/algo/int_algo.h>
 #include <cds/algo/int_algo.h>
-
 #include <boost/mpl/if.hpp>
 
 namespace cds { namespace lock {
 #include <boost/mpl/if.hpp>
 
 namespace cds { namespace lock {
@@ -273,38 +272,44 @@ namespace cds { namespace lock {
         }
     };
 
         }
     };
 
+}} // namespace cds::lock
+
+//@cond
+namespace std {
+
     /// Specialization \ref scoped_lock for lock::array
     template <typename Lock, typename SelectPolicy, class Alloc>
     /// Specialization \ref scoped_lock for lock::array
     template <typename Lock, typename SelectPolicy, class Alloc>
-    class scoped_lock< cds::lock::array< Lock, SelectPolicy, Alloc > >: public cds::details::noncopyable
+    class unique_lock< cds::lock::array< Lock, SelectPolicy, Alloc > >
     {
     public:
     {
     public:
-        typedef cds::lock::array< Lock, SelectPolicy, Alloc >   lock_array_type ;   ///< Lock array type
+        typedef cds::lock::array< Lock, SelectPolicy, Alloc >   lock_array_type;   ///< Lock array type
 
     private:
 
     private:
-        //@cond
         lock_array_type&    m_arrLocks;
         size_t              m_nLockGuarded;
 
         lock_array_type&    m_arrLocks;
         size_t              m_nLockGuarded;
 
-        static const size_t c_nLockAll = ~size_t(0);
-        //@endcond
+        static const size_t c_nLockAll = ~size_t( 0 );
 
     public:
         /// Onws the lock array \p arrLocks and locks a cell determined by \p hint parameter
         template <typename Q>
 
     public:
         /// Onws the lock array \p arrLocks and locks a cell determined by \p hint parameter
         template <typename Q>
-        scoped_lock( lock_array_type& arrLocks, Q const& hint )
+        unique_lock( lock_array_type& arrLocks, Q const& hint )
             : m_arrLocks( arrLocks )
             : m_arrLocks( arrLocks )
-            , m_nLockGuarded( arrLocks.lock( hint ))
+            , m_nLockGuarded( arrLocks.lock( hint ) )
         {}
 
         /// Locks all from \p arrLocks array
         {}
 
         /// Locks all from \p arrLocks array
-        scoped_lock( lock_array_type& arrLocks )
+        unique_lock( lock_array_type& arrLocks )
             : m_arrLocks( arrLocks )
             , m_nLockGuarded( c_nLockAll )
         {
             arrLocks.lock_all();
         }
 
             : m_arrLocks( arrLocks )
             , m_nLockGuarded( c_nLockAll )
         {
             arrLocks.lock_all();
         }
 
-        ~scoped_lock()
+        unique_lock() = delete;
+        unique_lock( unique_lock const& ) = delete;
+
+        ~unique_lock()
         {
             if ( m_nLockGuarded == c_nLockAll )
                 m_arrLocks.unlock_all();
         {
             if ( m_nLockGuarded == c_nLockAll )
                 m_arrLocks.unlock_all();
@@ -312,7 +317,7 @@ namespace cds { namespace lock {
                 m_arrLocks.unlock( m_nLockGuarded );
         }
     };
                 m_arrLocks.unlock( m_nLockGuarded );
         }
     };
-
-}} // namespace cds::lock
+} // namespace std
+//@endcond
 
 #endif // #ifndef __CDS_LOCK_ARRAY_H
 
 #endif // #ifndef __CDS_LOCK_ARRAY_H
diff --git a/cds/lock/scoped_lock.h b/cds/lock/scoped_lock.h
deleted file mode 100644 (file)
index 13b78f2..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//$$CDS-header$$-2
-
-#ifndef __CDS_LOCK_SCOPED_LOCK_H
-#define __CDS_LOCK_SCOPED_LOCK_H
-
-#include <cds/details/defs.h>
-#include <cds/details/noncopyable.h>
-
-namespace cds { namespace lock {
-
-    /// Scoped lock
-    /**
-
-        An object of type \p scoped_lock controls the ownership of a lockable object within a scope.
-        A \p scoped_lock object maintains ownership of a lockable object throughout the \p scoped_lock object\92s lifetime.
-        The behavior of a program is undefined if the lockable object does not exist for the entire lifetime
-        of the \p scoped_lock object.
-        The supplied \p Lock type shall have two methods: \p lock and \p unlock.
-
-        The constructor locks the wrapped lock object, the destructor unlocks it.
-
-        Scoped lock is not copy-constructible and not default-constructible.
-
-        This class is similar to \p std::lock_quard
-    */
-    template <class Lock>
-    class scoped_lock: public cds::details::noncopyable
-    {
-    public:
-        typedef Lock lock_type ;    ///< Lock type
-
-    protected:
-        lock_type&  m_Lock ;        ///< Owned lock object
-
-    protected:
-        //@cond
-        // Only for internal use!!!
-        scoped_lock()
-        {}
-        //@endcond
-    public:
-        /// Get ownership of lock object \p l and calls <tt>l.lock()</tt>
-        scoped_lock( lock_type& l )
-            : m_Lock( l )
-        {
-            l.lock();
-        }
-
-        /// Get ownership of lock object \p l and conditionally locks it
-        /**
-            The constructor calls <tt>l.lock()</tt> only if \p bAlreadyLocked is \p false.
-            If \p bAlreadyLocked is \p true, no locking is performed.
-
-            In any case, the destructor of \p scoped_lock object invokes <tt>l.unlock()</tt>.
-        */
-        scoped_lock( lock_type& l, bool bAlreadyLocked )
-            : m_Lock( l )
-        {
-            if ( !bAlreadyLocked )
-                l.lock();
-        }
-
-        /// Unlock underlying lock object and release ownership
-        ~scoped_lock()
-        {
-            m_Lock.unlock();
-        }
-    };
-}}  // namespace cds::lock
-
-
-#endif // #ifndef __CDS_LOCK_SCOPED_LOCK_H
index 8bd65fb0b69d1ce6321d497de2960147cd46e493..37842a535a6972de97e66bd9ab79ea751d47f58b 100644 (file)
@@ -15,7 +15,6 @@
 #include <cds/cxx11_atomic.h>
 #include <cds/os/thread.h>
 #include <cds/algo/backoff_strategy.h>
 #include <cds/cxx11_atomic.h>
 #include <cds/os/thread.h>
 #include <cds/algo/backoff_strategy.h>
-#include <cds/lock/scoped_lock.h>
 
 #include <cds/details/noncopyable.h>
 
 
 #include <cds/details/noncopyable.h>
 
index 8da141ef40967d0d7625b315c64d582610e94ba4..35f4ffaeddc3a58f7aa513cf2525a545ca284ca7 100644 (file)
@@ -15,6 +15,8 @@
     2011.01.02 khizmax  Created
 */
 
     2011.01.02 khizmax  Created
 */
 
+#include <stdlib.h>
+#include <mutex>        // unique_lock
 #include <cds/init.h>
 #include <cds/memory/michael/options.h>
 #include <cds/memory/michael/bound_check.h>
 #include <cds/init.h>
 #include <cds/memory/michael/options.h>
 #include <cds/memory/michael/bound_check.h>
@@ -30,7 +32,6 @@
 #include <cds/user_setup/cache_line.h>
 #include <cds/details/lib.h>
 
 #include <cds/user_setup/cache_line.h>
 #include <cds/details/lib.h>
 
-#include <stdlib.h>
 #include <boost/intrusive/list.hpp>
 
 namespace cds {
 #include <boost/intrusive/list.hpp>
 
 namespace cds {
@@ -306,7 +307,7 @@ namespace michael {
         typedef details::free_list_locked_hook item_hook;
         typedef Lock lock_type;
     protected:
         typedef details::free_list_locked_hook item_hook;
         typedef Lock lock_type;
     protected:
-        typedef cds::lock::scoped_lock<lock_type>   auto_lock;
+        typedef std::unique_lock<lock_type>   auto_lock;
 
         mutable lock_type   m_access;
         //@endcond
 
         mutable lock_type   m_access;
         //@endcond
@@ -360,7 +361,7 @@ namespace michael {
         typedef details::partial_list_locked_hook item_hook;
         typedef Lock    lock_type;
     protected:
         typedef details::partial_list_locked_hook item_hook;
         typedef Lock    lock_type;
     protected:
-        typedef cds::lock::scoped_lock<lock_type>   auto_lock;
+        typedef std::unique_lock<lock_type>   auto_lock;
 
         mutable lock_type   m_access;
         //@endcond
 
         mutable lock_type   m_access;
         //@endcond
index c822268df02cd9db3eecbd3df9f08656d32b7b2c..9e8c4c63458054f29a32234a9eebec2527d3f428 100644 (file)
@@ -196,7 +196,7 @@ namespace cds { namespace urcu {
             uint64_t nEpoch;
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
             uint64_t nEpoch;
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
-                cds::lock::scoped_lock<lock_type> sl( m_Lock );
+                std::unique_lock<lock_type> sl( m_Lock );
                 if ( ep.m_p && m_Buffer.push( ep ) )
                     return false;
                 nEpoch = m_nCurEpoch.fetch_add( 1, atomics::memory_order_relaxed );
                 if ( ep.m_p && m_Buffer.push( ep ) )
                     return false;
                 nEpoch = m_nCurEpoch.fetch_add( 1, atomics::memory_order_relaxed );
index f4eee83eea2256619b77a0a802ba60cd96ad833b..a9ffda3b5d694b02cd7e4cd82d4b79777ff42136 100644 (file)
@@ -6,7 +6,6 @@
 #include <mutex>
 #include <cds/urcu/details/gp.h>
 #include <cds/algo/backoff_strategy.h>
 #include <mutex>
 #include <cds/urcu/details/gp.h>
 #include <cds/algo/backoff_strategy.h>
-#include <cds/lock/scoped_lock.h>
 
 namespace cds { namespace urcu {
 
 
 namespace cds { namespace urcu {
 
@@ -136,7 +135,7 @@ namespace cds { namespace urcu {
         {
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
         {
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
-                cds::lock::scoped_lock<lock_type> sl( m_Lock );
+                std::unique_lock<lock_type> sl( m_Lock );
                 flip_and_wait();
                 flip_and_wait();
             }
                 flip_and_wait();
                 flip_and_wait();
             }
index 31e03c212ef6a3a0095b6081be8feb35bbe0526f..f7712634f58cb607ba35edc885982f5a481b2d13 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef _CDS_URCU_DETAILS_GPT_H
 #define _CDS_URCU_DETAILS_GPT_H
 
 #ifndef _CDS_URCU_DETAILS_GPT_H
 #define _CDS_URCU_DETAILS_GPT_H
 
+#include <mutex>    //unique_lock
 #include <cds/urcu/details/gp.h>
 #include <cds/urcu/dispose_thread.h>
 #include <cds/algo/backoff_strategy.h>
 #include <cds/urcu/details/gp.h>
 #include <cds/urcu/dispose_thread.h>
 #include <cds/algo/backoff_strategy.h>
@@ -200,7 +201,7 @@ namespace cds { namespace urcu {
 
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
 
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
-                cds::lock::scoped_lock<lock_type> sl( m_Lock );
+                std::unique_lock<lock_type> sl( m_Lock );
                 flip_and_wait();
                 flip_and_wait();
 
                 flip_and_wait();
                 flip_and_wait();
 
index 69530feb4016d702db4022d1e723abe7dbc47267..13786c7d090fc6f80e3440ee4dcabb2b4e90d6d9 100644 (file)
@@ -194,7 +194,7 @@ namespace cds { namespace urcu {
             uint64_t nEpoch;
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
             uint64_t nEpoch;
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
-                cds::lock::scoped_lock<lock_type> sl( m_Lock );
+                std::unique_lock<lock_type> sl( m_Lock );
                 if ( ep.m_p && m_Buffer.push( ep ) && m_Buffer.size() < capacity())
                     return false;
                 nEpoch = m_nCurEpoch.fetch_add( 1, atomics::memory_order_relaxed );
                 if ( ep.m_p && m_Buffer.push( ep ) && m_Buffer.size() < capacity())
                     return false;
                 nEpoch = m_nCurEpoch.fetch_add( 1, atomics::memory_order_relaxed );
index ca3795e8f2b999a62e21715ea35bc7c25f5ef776..2f5db2e215edcdc8453ea8f4f781c0d2e4ff58a7 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef _CDS_URCU_DETAILS_SIG_THREADED_H
 #define _CDS_URCU_DETAILS_SIG_THREADED_H
 
 #ifndef _CDS_URCU_DETAILS_SIG_THREADED_H
 #define _CDS_URCU_DETAILS_SIG_THREADED_H
 
+#include <mutex>    //unique_lock
 #include <cds/urcu/details/sh.h>
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
 
 #include <cds/urcu/details/sh.h>
 #ifdef CDS_URCU_SIGNAL_HANDLING_ENABLED
 
@@ -199,7 +200,7 @@ namespace cds { namespace urcu {
 
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
 
             atomics::atomic_thread_fence( atomics::memory_order_acquire );
             {
-                cds::lock::scoped_lock<lock_type> sl( m_Lock );
+                std::unique_lock<lock_type> sl( m_Lock );
 
                 back_off bkOff;
                 base_class::force_membar_all_threads( bkOff );
 
                 back_off bkOff;
                 base_class::force_membar_all_threads( bkOff );
index cea98ac6b197cad16b32c59e74c3e81d5548425f..1a36281a63ba021eb45865d75039c348cc21d5ae 100644 (file)
     <ClInclude Include="..\..\..\cds\intrusive\striped_set\resizing_policy.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\striped_set\striping_policy.h" />\r
     <ClInclude Include="..\..\..\cds\lock\array.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\striped_set\resizing_policy.h" />\r
     <ClInclude Include="..\..\..\cds\intrusive\striped_set\striping_policy.h" />\r
     <ClInclude Include="..\..\..\cds\lock\array.h" />\r
-    <ClInclude Include="..\..\..\cds\lock\scoped_lock.h" />\r
     <ClInclude Include="..\..\..\cds\memory\mapper.h" />\r
     <ClInclude Include="..\..\..\cds\memory\pool_allocator.h" />\r
     <ClInclude Include="..\..\..\cds\memory\vyukov_queue_pool.h" />\r
     <ClInclude Include="..\..\..\cds\memory\mapper.h" />\r
     <ClInclude Include="..\..\..\cds\memory\pool_allocator.h" />\r
     <ClInclude Include="..\..\..\cds\memory\vyukov_queue_pool.h" />\r
index 74f37bfe4755c8444b40baea68f70588d45f3e43..f4b36afd2866f864c4a1b0c2832685882cec2037 100644 (file)
     <ClInclude Include="..\..\..\cds\lock\array.h">\r
       <Filter>Header Files\cds\lock</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\cds\lock\array.h">\r
       <Filter>Header Files\cds\lock</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="..\..\..\cds\lock\scoped_lock.h">\r
-      <Filter>Header Files\cds\lock</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="..\..\..\cds\container\details\make_split_list_set.h">\r
       <Filter>Header Files\cds\container\details</Filter>\r
     </ClInclude>\r
     <ClInclude Include="..\..\..\cds\container\details\make_split_list_set.h">\r
       <Filter>Header Files\cds\container\details</Filter>\r
     </ClInclude>\r
index d8a6e00cb292bf09802ea7efe72f8f0b7ac2ab08..719c1c7c8cc8c9d40c738e9b88d6f881a8caf196 100644 (file)
@@ -1,6 +1,7 @@
 //$$CDS-header$$
 
 #include <functional>
 //$$CDS-header$$
 
 #include <functional>
+#include <mutex>    //unique_lock
 #include "map2/map_types.h"
 #include "cppunit/thread.h"
 
 #include "map2/map_types.h"
 #include "cppunit/thread.h"
 
@@ -89,7 +90,7 @@ namespace map2 {
 
                 void operator()( pair_type& val )
                 {
 
                 void operator()( pair_type& val )
                 {
-                    cds::lock::scoped_lock< typename value_type::lock_type>    ac( val.second.m_access );
+                    std::unique_lock< typename value_type::lock_type>    ac( val.second.m_access );
 
                     val.second.nKey  = val.first;
                     val.second.nData = val.first * 8;
 
                     val.second.nKey  = val.first;
                     val.second.nData = val.first * 8;
@@ -182,7 +183,7 @@ namespace map2 {
 
                 void operator()( bool bNew, pair_type& val )
                 {
 
                 void operator()( bool bNew, pair_type& val )
                 {
-                    cds::lock::scoped_lock<typename value_type::lock_type>    ac( val.second.m_access );
+                    std::unique_lock<typename value_type::lock_type>    ac( val.second.m_access );
                     if ( bNew ) {
                         ++nCreated;
                         val.second.nKey = val.first;
                     if ( bNew ) {
                         ++nCreated;
                         val.second.nKey = val.first;
@@ -305,7 +306,7 @@ namespace map2 {
                 {
                     while ( true ) {
                         if ( item.second.bInitialized.load( atomics::memory_order_relaxed )) {
                 {
                     while ( true ) {
                         if ( item.second.bInitialized.load( atomics::memory_order_relaxed )) {
-                            cds::lock::scoped_lock< typename value_type::lock_type>    ac( item.second.m_access );
+                            std::unique_lock< typename value_type::lock_type>    ac( item.second.m_access );
 
                             if ( m_cnt.nKeyExpected == item.second.nKey && m_cnt.nKeyExpected * 8 == item.second.nData )
                                 ++m_cnt.nSuccessItem;
 
                             if ( m_cnt.nKeyExpected == item.second.nKey && m_cnt.nKeyExpected * 8 == item.second.nData )
                                 ++m_cnt.nSuccessItem;
index 6140f45d4b36750fa2b1e69906052b02757f8e92..5cb7ac81b63d99ffb7650c45007302bce715f139 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef __CDSUNIT_STD_HASH_MAP_GCC_H
 #define __CDSUNIT_STD_HASH_MAP_GCC_H
 
 #ifndef __CDSUNIT_STD_HASH_MAP_GCC_H
 #define __CDSUNIT_STD_HASH_MAP_GCC_H
 
+#include <mutex>    //unique_lock
 #include <unordered_map>
 #include <functional>   // ref
 
 #include <unordered_map>
 #include <functional>   // ref
 
@@ -21,7 +22,7 @@ namespace map2 {
     {
     public:
         Lock m_lock;
     {
     public:
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef std::unordered_map<
             Key, Value
             , std::hash<Key>
         typedef std::unordered_map<
             Key, Value
             , std::hash<Key>
index 5e9c8c8b9cff4fcd25f9adf4fad406e906b7914d..9acb49aaad47f61604f0396ca87a42e6b7eb12e6 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <hash_map>
 #include <functional>   // ref
 
 #include <hash_map>
 #include <functional>   // ref
+#include <mutex>    //unique_lock
 
 namespace map2 {
     template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
 
 namespace map2 {
     template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
@@ -12,7 +13,7 @@ namespace map2 {
     {
     public:
         Lock m_lock;
     {
     public:
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef stdext::hash_map<Key, Value, stdext::hash_compare<Key, std::less<Key> >, Alloc>   base_class;
     public:
         typedef typename base_class::mapped_type value_type;
         typedef stdext::hash_map<Key, Value, stdext::hash_compare<Key, std::less<Key> >, Alloc>   base_class;
     public:
         typedef typename base_class::mapped_type value_type;
index 67c3d698135b1d64ae7c35099316125a7ff449b1..c798c9cc05ac13e7d234bb30c9328d097941ec7f 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <map>
 #include <functional>   // ref
 
 #include <map>
 #include <functional>   // ref
+#include <mutex>    //unique_lock
 
 namespace map2 {
 
 
 namespace map2 {
 
@@ -14,7 +15,7 @@ namespace map2 {
     class StdMap: public std::map<Key, Value, std::less<Key>, Alloc>
     {
         Lock m_lock;
     class StdMap: public std::map<Key, Value, std::less<Key>, Alloc>
     {
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef std::map<Key, Value, std::less<Key>, Alloc> base_class;
     public:
         typedef typename base_class::mapped_type value_type;
         typedef std::map<Key, Value, std::less<Key>, Alloc> base_class;
     public:
         typedef typename base_class::mapped_type value_type;
index 655b4d8060d479f2aeb63a96355bc7e77a90245b..021005e4a694db54f7274df28a26a8ea41d1c849 100644 (file)
@@ -5,13 +5,14 @@
 
 #include <map>
 #include <functional>   // ref
 
 #include <map>
 #include <functional>   // ref
+#include <mutex>    //unique_lock
 
 namespace map2 {
     template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
     class StdMap: public std::map<Key, Value, std::less<Key>, Alloc>
     {
         Lock m_lock;
 
 namespace map2 {
     template <typename Key, typename Value, typename Lock, class Alloc = CDS_DEFAULT_ALLOCATOR>
     class StdMap: public std::map<Key, Value, std::less<Key>, Alloc>
     {
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef std::map<Key, Value, std::less<Key>, Alloc> base_class;
     public:
         typedef typename base_class::mapped_type value_type;
         typedef std::map<Key, Value, std::less<Key>, Alloc> base_class;
     public:
         typedef typename base_class::mapped_type value_type;
index 85c19e6c54dbaebda6a2d82c43d7000330c2f041..d95a88c4d153095aaada4e554d313253c41a753f 100644 (file)
@@ -4,6 +4,7 @@
 #define __CDSUNIT_STD_PQUEUE_H
 
 #include <queue>
 #define __CDSUNIT_STD_PQUEUE_H
 
 #include <queue>
+#include <mutex>    //unique_lock
 
 namespace pqueue {
 
 
 namespace pqueue {
 
@@ -18,21 +19,7 @@ namespace pqueue {
         pqueue_type     m_PQueue;
         mutable Lock    m_Lock;
 
         pqueue_type     m_PQueue;
         mutable Lock    m_Lock;
 
-        struct scoped_lock
-        {
-            Lock&   m_lock;
-
-            scoped_lock( Lock& l )
-                : m_lock(l)
-            {
-                l.lock();
-            }
-
-            ~scoped_lock()
-            {
-                m_lock.unlock();
-            }
-        };
+        typedef std::unique_lock<Lock> scoped_lock;
 
     public:
         bool push( value_type const& val )
 
     public:
         bool push( value_type const& val )
index 6ac385ba222138e527f58ec7ee22c55df9f58ed3..5c6d33e6ca4dee754bf64f7c6d7b3724608b1ff3 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef __UNIT_QUEUE_STD_QUEUE_H
 #define __UNIT_QUEUE_STD_QUEUE_H
 
 #ifndef __UNIT_QUEUE_STD_QUEUE_H
 #define __UNIT_QUEUE_STD_QUEUE_H
 
+#include <mutex>    //unique_lock
 #include <queue>
 #include <cds/lock/spinlock.h>
 
 #include <queue>
 #include <cds/lock/spinlock.h>
 
@@ -17,7 +18,7 @@ namespace queue {
     public:
         bool enqueue( const T& data )
         {
     public:
         bool enqueue( const T& data )
         {
-            cds::lock::scoped_lock<Lock> a(m_Locker);
+            std::unique_lock<Lock> a(m_Locker);
 
             base_class::push( data );
             return true;
 
             base_class::push( data );
             return true;
@@ -25,7 +26,7 @@ namespace queue {
         bool push( const T& data )  { return enqueue( data ) ; }
         bool dequeue( T& data )
         {
         bool push( const T& data )  { return enqueue( data ) ; }
         bool dequeue( T& data )
         {
-            cds::lock::scoped_lock<Lock> a(m_Locker);
+            std::unique_lock<Lock> a(m_Locker);
             if ( base_class::empty() )
                 return false;
 
             if ( base_class::empty() )
                 return false;
 
index 11f6bfbcddd6ecb968466542bade3650206fee67..df0ebc04e63c9912c27fb6bcdc6610644ab975ad 100644 (file)
@@ -2,6 +2,7 @@
 
 #include <functional>
 #include <vector>
 
 #include <functional>
 #include <vector>
+#include <mutex>    //unique_lock
 
 #include "set2/set_types.h"
 #include "cppunit/thread.h"
 
 #include "set2/set_types.h"
 #include "cppunit/thread.h"
@@ -90,7 +91,7 @@ namespace set2 {
 
                 void operator()( keyval_type& val )
                 {
 
                 void operator()( keyval_type& val )
                 {
-                    cds::lock::scoped_lock< typename value_type::lock_type>    ac( val.val.m_access );
+                    std::unique_lock< typename value_type::lock_type>    ac( val.val.m_access );
 
                     val.val.nKey  = val.key;
                     val.val.nData = val.key * 8;
 
                     val.val.nKey  = val.key;
                     val.val.nData = val.key * 8;
@@ -185,7 +186,7 @@ namespace set2 {
 
                 void operator()( bool bNew, keyval_type& val, size_t nKey )
                 {
 
                 void operator()( bool bNew, keyval_type& val, size_t nKey )
                 {
-                    cds::lock::scoped_lock<typename value_type::lock_type>    ac( val.val.m_access );
+                    std::unique_lock<typename value_type::lock_type>    ac( val.val.m_access );
                     if ( !val.val.bInitialized )
                     {
                         val.val.nKey = val.key;
                     if ( !val.val.bInitialized )
                     {
                         val.val.nKey = val.key;
@@ -312,7 +313,7 @@ namespace set2 {
                     while ( true ) {
                         bool bBkoff = false;
                         {
                     while ( true ) {
                         bool bBkoff = false;
                         {
-                            cds::lock::scoped_lock< typename value_type::lock_type>    ac( item.val.m_access );
+                            std::unique_lock< typename value_type::lock_type>    ac( item.val.m_access );
                             if ( item.val.bInitialized ) {
                                 if ( m_cnt.nKeyExpected == item.val.nKey && m_cnt.nKeyExpected * 8 == item.val.nData )
                                     ++m_cnt.nSuccessItem;
                             if ( item.val.bInitialized ) {
                                 if ( m_cnt.nKeyExpected == item.val.nKey && m_cnt.nKeyExpected * 8 == item.val.nData )
                                     ++m_cnt.nSuccessItem;
index fca8b853e79f47d3f8ef55024f425510519e00b6..55845ce920a0faf54443d0b8b40ee276eb3f119f 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <unordered_set>
 #include <functional>   // ref
 
 #include <unordered_set>
 #include <functional>   // ref
+#include <mutex>    //unique_lock
 
 namespace set2 {
 
 
 namespace set2 {
 
@@ -21,7 +22,7 @@ namespace set2 {
     {
     public:
         Lock m_lock;
     {
     public:
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef std::unordered_set<
             Value
             , Hash
         typedef std::unordered_set<
             Value
             , Hash
index 7282ce03c1367ed29b1aa4e39cca4d53c963d539..64ed69771aa97c7e909212257104769d7802c1aa 100644 (file)
@@ -4,6 +4,7 @@
 #define __CDSUNIT_STD_HASH_SET_VC_H
 
 #include <hash_set>
 #define __CDSUNIT_STD_HASH_SET_VC_H
 
 #include <hash_set>
+#include <mutex>    //unique_lock
 
 namespace set2 {
 
 
 namespace set2 {
 
@@ -27,7 +28,7 @@ namespace set2 {
     {
     public:
         Lock m_lock;
     {
     public:
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef stdext::hash_set<Value, hash_less<Value, Hash, Less >, Alloc> base_class;
 
     public:
         typedef stdext::hash_set<Value, hash_less<Value, Hash, Less >, Alloc> base_class;
 
     public:
index 2f55586c358be6cb2e557ddb9d1f092254d93b4b..fa9a270d55b1a8b84a958dc40dea9b215cb110a8 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <set>
 #include <functional>   // ref
 
 #include <set>
 #include <functional>   // ref
+#include <mutex>    //unique_lock
 
 namespace set2 {
     template <typename Value, typename Less, typename Lock,
 
 namespace set2 {
     template <typename Value, typename Less, typename Lock,
@@ -13,7 +14,7 @@ namespace set2 {
     class StdSet: public std::set<Value, Less, Alloc>
     {
         Lock m_lock;
     class StdSet: public std::set<Value, Less, Alloc>
     {
         Lock m_lock;
-        typedef cds::lock::scoped_lock<Lock> AutoLock;
+        typedef std::unique_lock<Lock> AutoLock;
         typedef std::set<Value, Less, Alloc> base_class;
     public:
         typedef typename base_class::key_type value_type;
         typedef std::set<Value, Less, Alloc> base_class;
     public:
         typedef typename base_class::key_type value_type;