issue #76: added cds::atomicity::cache_friendly_item_counter to avoid false sharing
[libcds.git] / cds / intrusive / details / feldman_hashset_base.h
index cc688f796cfd43a68d8ce36f6fb631b4dbcf3b1a..60b00a629dd133f2156a348c17a7c592dca0bc1e 100644 (file)
@@ -243,7 +243,7 @@ namespace cds { namespace intrusive {
                 the \p empty() member function depends on correct item counting.
                 Therefore, \p atomicity::empty_item_counter is not allowed as a type of the option.
 
-                Default is \p atomicity::item_counter.
+                Default is \p atomicity::item_counter. To avoid false sharing you can aldo use \p atomicity::cache_friendly_item_counter
             */
             typedef cds::atomicity::item_counter item_counter;
 
@@ -301,7 +301,7 @@ namespace cds { namespace intrusive {
                  The item counting is an important part of \p FeldmanHashSet algorithm:
                  the \p empty() member function depends on correct item counting.
                  Therefore, \p atomicity::empty_item_counter is not allowed as a type of the option.
-                 Default is \p atomicity::item_counter.
+                 Default is \p atomicity::item_counter. To avoid false sharing you can use or \p atomicity::cache_friendly_item_counter
             - \p opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
                 or \p opt::v::sequential_consistent (sequentially consisnent memory model).
             - \p opt::stat - internal statistics. By default, it is disabled (\p feldman_hashset::empty_stat).
@@ -479,7 +479,7 @@ namespace cds { namespace intrusive {
                     splitter.reset();
                     pArr = arr.head();
                     nSlot = splitter.cut( static_cast<unsigned>( arr.metrics().head_node_size_log ));
-                    assert( nSlot < arr.metrics().head_node_size );
+                    assert( static_cast<size_t>( nSlot ) < arr.metrics().head_node_size );
                     nHeight = 1;
                 }
             };
@@ -514,7 +514,7 @@ namespace cds { namespace intrusive {
                         assert(slot.ptr() != nullptr);
                         assert( !pos.splitter.eos());
                         pos.nSlot = pos.splitter.cut( static_cast<unsigned>( metrics().array_node_size_log ));
-                        assert( pos.nSlot < metrics().array_node_size );
+                        assert( static_cast<size_t>( pos.nSlot ) < metrics().array_node_size );
                         pos.pArr = to_array(slot.ptr());
                         ++pos.nHeight;
                     }