template <class Functor, typename T>
struct static_functor
{
- static void call( T * p )
+ static void call( void* p )
{
- Functor()( p );
+ Functor()( reinterpret_cast<T*>( p ));
}
};
{}
/// Typecasting ctor
+ template <typename T>
+ retired_ptr( T* p, free_retired_ptr_func func) CDS_NOEXCEPT
+ : m_p( reinterpret_cast<pointer>(p))
+ , m_funcFree( func )
+ {}
+/*
template <typename T>
retired_ptr( T * p, void (* pFreeFunc)(T *)) CDS_NOEXCEPT
: m_p( reinterpret_cast<pointer>(p))
, m_funcFree( reinterpret_cast< free_retired_ptr_func >( pFreeFunc ))
{}
+*/
/// Assignment operator
retired_ptr& operator =( retired_ptr const& s) CDS_NOEXCEPT
}
/// Invokes destructor function for the pointer
- void free() CDS_SUPPRESS_SANITIZE( "function" )
+ void free()
{
assert( m_funcFree );
assert( m_p );
\p func is a disposer: when \p p can be safely removed, \p func is called.
*/
template <typename T>
- static void retire( T * p, void (* func)(T *))
+ static void retire( T * p, void (* func)(void *))
{
dhp::thread_data* rec = dhp::smr::tls();
if ( !rec->retired_.push( dhp::retired_ptr( p, func ) ) )
\endcode
*/
template <class Disposer, typename T>
- static void retire( T * p )
+ static void retire( T* p )
{
if ( !dhp::smr::tls()->retired_.push( dhp::retired_ptr( p, cds::details::static_functor<Disposer, T>::call )))
scan();
\p func is a disposer: when \p p can be safely removed, \p func is called.
*/
template <typename T>
- static void retire( T * p, void( *func )( T * ))
+ static void retire( T * p, void( *func )( void * ))
{
hp::thread_data* rec = hp::smr::tls();
if ( !rec->retired_.push( hp::retired_ptr( p, func )))
protected:
//@cond
- static void free_leaf_node( value_type * p )
+ static void free_leaf_node( void* p )
{
- disposer()( p );
+ disposer()( reinterpret_cast<value_type*>( p ));
}
internal_node * alloc_internal_node() const
return pNode;
}
- static void free_internal_node( internal_node * pNode )
+ static void free_internal_node( void* pNode )
{
- cxx_node_allocator().Delete( pNode );
+ cxx_node_allocator().Delete( reinterpret_cast<internal_node*>( pNode ));
}
struct internal_node_deleter {
return cxx_update_desc_allocator().New();
}
- static void free_update_desc( update_desc * pDesc )
+ static void free_update_desc( void* pDesc )
{
- cxx_update_desc_allocator().Delete( pDesc );
+ cxx_update_desc_allocator().Delete( reinterpret_cast<update_desc*>( pDesc ));
}
void retire_node( tree_node * pNode ) const
return node_traits::to_value_ptr( p.ptr());
}
- static void dispose_node( value_type * pVal )
+ static void dispose_node( void* p )
{
- assert( pVal != nullptr );
+ assert( p != nullptr );
+ value_type* pVal = reinterpret_cast<value_type*>( p );
typename node_builder::node_disposer()( node_traits::to_node_ptr( pVal ));
disposer()( pVal );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename T>
- static void retire_ptr( T * p, void (* pFunc)(T *))
+ static void retire_ptr( T * p, free_retired_ptr_func pFunc )
{
- retired_ptr rp( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc ));
+ retired_ptr rp( p, pFunc );
retire_ptr( rp );
}
and then evaluates disposing expression <tt>pFunc( p )</tt>
*/
template <typename T>
- static void retire_ptr( T * p, void (* pFunc)(T *))
+ static void retire_ptr( T* p, free_retired_ptr_func pFunc )
{
- retired_ptr rp( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc ));
+ retired_ptr rp( p, pFunc );
retire_ptr( rp );
}
and then evaluates disposing expression <tt>Disposer()( p )</tt>
*/
template <typename Disposer, typename T>
- static void retire_ptr( T * p )
+ static void retire_ptr( T* p )
{
retire_ptr( p, cds::details::static_functor<Disposer, T>::call );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename T>
- static void retire_ptr( T * p, void (* pFunc)(T *))
+ static void retire_ptr( T* p, free_retired_ptr_func pFunc )
{
- retired_ptr rp( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc ));
+ retired_ptr rp( p, pFunc );
retire_ptr( rp );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename Disposer, typename T>
- static void retire_ptr( T * p )
+ static void retire_ptr( T* p )
{
retire_ptr( p, cds::details::static_functor<Disposer, T>::call );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename T>
- static void retire_ptr( T * p, void (* pFunc)(T *))
+ static void retire_ptr( T* p, free_retired_ptr_func pFunc )
{
- retired_ptr rp( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc ));
+ retired_ptr rp( p, pFunc );
retire_ptr( rp );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename Disposer, typename T>
- static void retire_ptr( T * p )
+ static void retire_ptr( T* p )
{
retire_ptr( p, cds::details::static_functor<Disposer, T>::call );
}
If the buffer is full, \ref synchronize function is invoked.
*/
template <typename T>
- static void retire_ptr( T * p, void (* pFunc)(T *))
+ static void retire_ptr( T* p, free_retired_ptr_func pFunc )
{
- retired_ptr rp( reinterpret_cast<void *>( p ), reinterpret_cast<free_retired_ptr_func>( pFunc ));
+ retired_ptr rp( p, pFunc );
retire_ptr( rp );
}