cds::urcu::details::conventional_exempt_pair_cast<node_type, value_type>
>;
/// Type of \p get() member function return value
- typedef value_type * get_result;
+ typedef value_type * raw_ptr;
protected:
//@cond
public:
using exempt_ptr = cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_traits::disposer >; ///< pointer to extracted node
/// Type of \p get() member function return value
- typedef value_type * get_result;
+ typedef value_type * raw_ptr;
private:
//@cond
>;
private:
+ //@cond
struct raw_ptr_converter
{
value_type * operator()( node_type * p ) const
return n.m_Data;
}
};
+ //@endcond
public:
/// Result of \p get(), \p get_with() functions - pointer to the node found
typedef cds::urcu::raw_ptr_adaptor< value_type, typename base_class::raw_ptr, raw_ptr_converter > raw_ptr;
- /// Type of \p get() member function return value
- typedef raw_ptr get_result;
protected:
//@cond
using exempt_ptr = cds::urcu::exempt_ptr< gc, node_type, value_type, typename maker::intrusive_traits::disposer >; ///< pointer to extracted node
private:
+ //@cond
struct raw_ptr_converter
{
value_type * operator()( node_type * p ) const
return n.m_Value;
}
};
+ //@endcond
public:
/// Result of \p get(), \p get_with() functions - pointer to the node found
typedef cds::urcu::raw_ptr_adaptor< value_type, typename base_class::raw_ptr, raw_ptr_converter > raw_ptr;
- /// Type of \p get() member function return value
- typedef raw_ptr get_result;
private:
//@cond
/// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
/// Type of \p get() member function return value
- typedef typename bucket_type::get_result get_result;
+ typedef typename bucket_type::raw_ptr raw_ptr;
//@cond
typedef cds::container::michael_map::implementation_tag implementation_tag;
typedef cds::container::MichaelHashMap< your_template_parameters > hash_map;
hash_map theMap;
// ...
- typename hash_map::get_result gp;
+ typename hash_map::raw_ptr gp;
{
// Lock RCU
hash_map::rcu_lock lock;
\endcode
*/
template <typename K>
- get_result get( K const& key )
+ raw_ptr get( K const& key )
{
return bucket( key ).get( key );
}
\p pred must imply the same element order as the comparator used for building the map.
*/
template <typename K, typename Less>
- get_result get_with( K const& key, Less pred )
+ raw_ptr get_with( K const& key, Less pred )
{
return bucket( key ).get_with( key, pred );
}
typedef typename bucket_type::rcu_lock rcu_lock; ///< RCU scoped lock
typedef typename bucket_type::exempt_ptr exempt_ptr; ///< pointer to extracted node
- typedef typename bucket_type::get_result get_result; ///< Return type of \p get() member function and its derivatives
+ typedef typename bucket_type::raw_ptr raw_ptr; ///< Return type of \p get() member function and its derivatives
/// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
\code
typedef cds::container::MichaelHashSet< your_template_parameters > hash_set;
hash_set theSet;
- typename hash_set::get_result gp;
+ typename hash_set::raw_ptr gp;
// ...
{
// Lock RCU
\endcode
*/
template <typename Q>
- get_result get( Q const& key )
+ raw_ptr get( Q const& key )
{
return bucket( key ).get( key );
}
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- get_result get_with( Q const& key, Less pred )
+ raw_ptr get_with( Q const& key, Less pred )
{
return bucket( key ).get_with( key, pred );
}
/// pointer to extracted node
using exempt_ptr = cds::urcu::exempt_ptr< gc, value_type, value_type, clear_and_dispose, void >;
/// Type of \p get() member function return value
- typedef value_type * get_result;
+ typedef value_type * raw_ptr;
protected:
//@cond
public:
/// Result of \p get(), \p get_with() functions - pointer to the node found
typedef cds::urcu::raw_ptr< gc, value_type, raw_ptr_disposer > raw_ptr;
- /// Type of \p get() member function return value
- typedef raw_ptr get_result;
protected:
//@cond
/// Bucket table allocator
typedef cds::details::Allocator< bucket_type, typename traits::allocator > bucket_table_allocator;
- typedef typename bucket_type::rcu_lock rcu_lock; ///< RCU scoped lock
- typedef typename bucket_type::exempt_ptr exempt_ptr; ///< pointer to extracted node
- typedef typename bucket_type::get_result get_result; ///< Return type of \p get() member function and its derivatives
+ typedef typename bucket_type::rcu_lock rcu_lock; ///< RCU scoped lock
+ typedef typename bucket_type::exempt_ptr exempt_ptr; ///< pointer to extracted node
+ typedef typename bucket_type::raw_ptr raw_ptr; ///< Return type of \p get() member function and its derivatives
/// Group of \p extract_xxx functions require external locking if underlying ordered list requires that
static CDS_CONSTEXPR const bool c_bExtractLockExternal = bucket_type::c_bExtractLockExternal;
hash_set theSet;
// ...
// Result of get() call
- typename hash_set::get_result ptr;
+ typename hash_set::raw_ptr ptr;
{
// Lock RCU
hash_set::rcu_lock lock;
\endcode
*/
template <typename Q>
- get_result get( Q const& key )
+ raw_ptr get( Q const& key )
{
return bucket( key ).get( key );
}
\p pred must imply the same element order as the comparator used for building the set.
*/
template <typename Q, typename Less>
- get_result get_with( Q const& key, Less pred )
+ raw_ptr get_with( Q const& key, Less pred )
{
return bucket( key ).get_with( key, pred );
}
{}
};
+ /// Rational load factor resizing policy
+ /** @ingroup cds_striped_resizing_policy
+ When total item count in a container exceeds
+ <tt>container.bucket_count() * Numerator / Denominator</tt>
+ then resizing is needed.
+
+ This policy is stateless: \p Numerator and \p Denominator specifies in compile time as template arguments
+ */
template <size_t Numerator, size_t Denominator = 1>
struct rational_load_factor_resizing
{
{}
};
+ /// Rational load factor resizing policy
+ /** @ingroup cds_striped_resizing_policy
+ When total item count in a container exceeds
+ <tt>container.bucket_count() * Numerator / Denominator</tt>
+ then resizing is needed.
+
+ This policy is stateful: \p Numerator and \p Denominator specifies in construction time.
+ */
template <size_t Denominator>
struct rational_load_factor_resizing<0, Denominator>
{
Template arguments:
- \p RCU - one of \ref cds_urcu_gc "RCU type"
- \p ValueType - type of values stored in container
- - \p ReclaimedEnumerator - implemntation-defined for each type of container
+ - \p ReclaimedEnumerator - implementation-defined for each type of container
Example: let \p Container is an RCU container
- \code
- Container c;
- // ...
- // Find a key
- typename Container::raw_ptr pRaw;
-
- // RCU locked section
- {
- typename Container::rcu_lock l;
- pRaw = c.get( key );
- if ( pRaw ) {
- // Deal with pRaw
+ @code
+ Container c;
+ // ...
+ // Find a key
+ typename Container::raw_ptr pRaw;
+
+ // RCU locked section
+ {
+ typename Container::rcu_lock l;
+ pRaw = c.get( key );
+ if ( pRaw ) {
+ // Deal with pRaw
+ }
}
- }
- // Release outside RCU-lock
- pRaw.release();
- \endcode
+ // Release outside RCU-lock
+ pRaw.release();
+ @endcode
*/
template <
class RCU,
{
public:
typedef RCU rcu; ///< RCU type - one of <tt>cds::urcu::gc< ... ></tt>
- typedef ValueType value_type; ///< Value type pointed by \p raw_ptr
+ typedef ValueType value_type; ///< Value type pointed by \p %raw_ptr
typedef ReclaimedEnumerator reclaimed_enumerator; ///< implementation-defined, for internal use only
private:
/// Copy ctor is prohibited
raw_ptr( raw_ptr const& ) = delete;
- ///@cond
+ //@cond
// Only for internal use
raw_ptr( value_type * p, reclaimed_enumerator&& e )
: m_ptr( p )
};
//@cond
- /// Adapter \p raw_ptr for non-intrusive containers based on intrusive counterpart
+ // Adapter of \p raw_ptr for non-intrusive containers based on intrusive counterpart
template <
typename ValueType,
typename RawPtr,
typedef Converter converter_type;
public:
- /// Constructs an empty raw pointer
+ // Constructs an empty raw pointer
raw_ptr_adaptor()
: intrusive_raw_ptr()
{}
- /// Move ctor
+ // Move ctor
raw_ptr_adaptor( intrusive_raw_ptr&& p )
: intrusive_raw_ptr( std::move(p))
{}
- /// Move ctor
+ // Move ctor
raw_ptr_adaptor( raw_ptr_adaptor&& p )
: intrusive_raw_ptr( std::move(p))
{}
- /// Copy ctor is prohibited
+ // Copy ctor is prohibited
raw_ptr_adaptor( raw_ptr_adaptor const& ) = delete;
- /// Releases the raw pointer
+ // Releases the raw pointer
~raw_ptr_adaptor()
{
release();
}
public:
- /// Move assignment operator
- /**
+ // Move assignment operator
+ /*
This operator may be called only inside RCU-lock.
The \p this should be empty.
return *this;
}
- /// Copy assignment is prohibited
+ // Copy assignment is prohibited
raw_ptr_adaptor& operator=( raw_ptr_adaptor const& ) = delete;
- /// Returns a pointer to stored value
+ // Returns a pointer to stored value
value_type * operator ->() const CDS_NOEXCEPT
{
return converter_type()( intrusive_raw_ptr::operator->());
}
- /// Returns a reference to stored value
+ // Returns a reference to stored value
value_type& operator *()
{
return converter_type()( intrusive_raw_ptr::operator*());
}
- /// Returns a reference to stored value
+ // Returns a reference to stored value
value_type const& operator *() const
{
return converter_type()( intrusive_raw_ptr::operator*());
}
- /// Checks if the \p %raw_ptr is \p nullptr
+ // Checks if the \p %raw_ptr is \p nullptr
bool empty() const CDS_NOEXCEPT
{
return intrusive_raw_ptr::empty();
}
- /// Checks if the \p %raw_ptr is not empty
+ // Checks if the \p %raw_ptr is not empty
explicit operator bool() const CDS_NOEXCEPT
{
return !empty();
}
- /// Releases the \p %raw_ptr object
- /**
+ // Releases the \p %raw_ptr object
+ /*
This function may be called only outside RCU section.
After \p %release() the object can be reused.
*/
}} // namespace cds::urcu
#endif // #ifndef CDSLIB_URCU_RAW_PTR_H
-
variants for MichaelList RCU-based specialization: extract() does not
require RCU locking, get() now returns special wrapper object of type raw_ptr,
see doc.
+ Thus, semantics of extract()/get() of all RCU-based set and maps based on
+ MichaelList (MichaelSet/Map, SplitListSet/Map) has been changed too.
- 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, it is kept
typedef typename Map::rcu_lock rcu_lock;
typedef typename Map::value_type value_type;
typename Map::exempt_ptr ep;
- typename Map::get_result gp;
+ typename Map::raw_ptr gp;
static size_t const nLimit = 100;
int arr[nLimit];
typedef typename Set::rcu_lock rcu_lock;
typename Set::exempt_ptr ep;
- typename Set::get_result gp;
+ typename Set::raw_ptr gp;
{
static size_t const nLimit = 1024;
typedef typename Set::rcu_lock rcu_lock;
typedef typename Set::value_type value_type;
typename Set::exempt_ptr ep;
- typename Set::get_result gp;
+ typename Set::raw_ptr gp;
static size_t const nLimit = 100;
int arr[nLimit];