X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cds%2Fcontainer%2Fsplit_list_set.h;h=ee62dbda46d60157c2806eb48801778d3fc08733;hb=0cc70e21edb12182af701a3d3ceffbb9a8fb19ad;hp=5ef7d955cc03df0f4d37590cbdbdc7ce507e3e48;hpb=cd515d6402be81b84e2eb0c9d4cf0a1ca9e4d95a;p=libcds.git diff --git a/cds/container/split_list_set.h b/cds/container/split_list_set.h index 5ef7d955..ee62dbda 100644 --- a/cds/container/split_list_set.h +++ b/cds/container/split_list_set.h @@ -180,6 +180,9 @@ namespace cds { namespace container { typedef typename base_class::item_counter item_counter; ///< Item counter type typedef typename base_class::stat stat; ///< Internal statistics + /// Count of hazard pointer required + static CDS_CONSTEXPR const size_t c_nHazardPtrCount = base_class::c_nHazardPtrCount; + protected: //@cond typedef typename maker::cxx_node_allocator cxx_node_allocator; @@ -246,26 +249,13 @@ namespace cds { namespace container { //@endcond protected: - /// Forward iterator - /** - \p IsConst - constness boolean flag - - The forward iterator for a split-list has the following features: - - it has no post-increment operator - - it depends on underlying ordered list iterator - - The iterator object cannot be moved across thread boundary since it contains GC's guard that is thread-private GC data. - - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent - deleting operations it is no guarantee that you iterate all item in the split-list. - - Therefore, the use of iterators in concurrent environment is not good idea. Use it for debug purpose only. - */ + //@cond template class iterator_type: protected base_class::template iterator_type { - //@cond typedef typename base_class::template iterator_type iterator_base_class; friend class SplitListSet; - //@endcond + public: /// Value pointer type (const for const iterator) typedef typename cds::details::make_const_type::pointer value_ptr; @@ -283,11 +273,9 @@ namespace cds { namespace container { {} protected: - //@cond explicit iterator_type( iterator_base_class const& src ) : iterator_base_class( src ) {} - //@endcond public: /// Dereference operator @@ -330,6 +318,7 @@ namespace cds { namespace container { return iterator_base_class::operator!=(i); } }; + //@endcond public: /// Initializes split-ordered list of default capacity @@ -351,7 +340,48 @@ namespace cds { namespace container { {} public: + ///@name Forward iterators (only for debugging purpose) + //@{ /// Forward iterator + /** + The forward iterator for a split-list has the following features: + - it has no post-increment operator + - it depends on underlying ordered list iterator + - The iterator object cannot be moved across thread boundary because it contains GC's guard that is thread-private GC data. + - Iterator ensures thread-safety even if you delete the item that iterator points to. However, in case of concurrent + deleting operations it is no guarantee that you iterate all item in the split-list. + Moreover, a crash is possible when you try to iterate the next element that has been deleted by concurrent thread. + + @warning Use this iterator on the concurrent container for debugging purpose only. + + The iterator interface: + \code + class iterator { + public: + // Default constructor + iterator(); + + // Copy construtor + iterator( iterator const& src ); + + // Dereference operator + value_type * operator ->() const; + + // Dereference operator + value_type& operator *() const; + + // Preincrement operator + iterator& operator ++(); + + // Assignment operator + iterator& operator = (iterator const& src); + + // Equality operators + bool operator ==(iterator const& i ) const; + bool operator !=(iterator const& i ) const; + }; + \endcode + */ typedef iterator_type iterator; /// Const forward iterator @@ -398,6 +428,7 @@ namespace cds { namespace container { { return const_iterator( base_class::cend()); } + //@} public: /// Inserts new node