};
/// FCQueue type traits
- struct type_traits: public cds::algo::flat_combining::type_traits
+ struct traits: public cds::algo::flat_combining::traits
{
typedef empty_stat stat; ///< Internal statistics
- static CDS_CONSTEXPR_CONST bool enable_elimination = false; ///< Enable \ref cds_elimination_description "elimination"
+ static CDS_CONSTEXPR const bool enable_elimination = false; ///< Enable \ref cds_elimination_description "elimination"
};
/// Metafunction converting option list to traits
/**
- This is a wrapper for <tt> cds::opt::make_options< type_traits, Options...> </tt>
\p Options are:
- \p opt::lock_type - mutex type, default is \p cds::lock::Spin
- - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::Default
+ - \p opt::back_off - back-off strategy, defalt is \p cds::backoff::delay_of<2>
- \p opt::allocator - allocator type, default is \ref CDS_DEFAULT_ALLOCATOR
- - \p opt::stat - internal statistics, possible type: \ref stat, \ref empty_stat (the default)
+ - \p opt::stat - internal statistics, possible type: \p fcqueue::stat, \p fcqueue::empty_stat (the default)
- \p opt::memory_model - C++ memory ordering model.
- List of all available memory ordering see opt::memory_model.
- Default if cds::opt::v:relaxed_ordering
+ List of all available memory ordering see \p opt::memory_model.
+ Default is \p cds::opt::v:relaxed_ordering
- \p opt::enable_elimination - enable/disable operation \ref cds_elimination_description "elimination"
By default, the elimination is disabled. For queue, the elimination is possible if the queue
is empty.
*/
- template <CDS_DECL_OPTIONS8>
+ template <typename... Options>
struct make_traits {
# ifdef CDS_DOXYGEN_INVOKED
typedef implementation_defined type ; ///< Metafunction result
# else
typedef typename cds::opt::make_options<
- typename cds::opt::find_type_traits< type_traits, CDS_OPTIONS8 >::type
- ,CDS_OPTIONS8
+ typename cds::opt::find_type_traits< traits, Options... >::type
+ ,Options...
>::type type;
# endif
};
Template parameters:
- \p T - a value type stored in the queue
- \p Queue - sequential queue implementation, default is \p std::queue<T>
- - \p Trats - type traits of flat combining, default is \p fcqueue::type_traits.
- \p fcqueue::make_traits metafunction can be used to construct specialized \p %type_traits
+ - \p Trats - type traits of flat combining, default is \p fcqueue::traits.
+ \p fcqueue::make_traits metafunction can be used to construct \p %fcqueue::traits specialization.
*/
template <typename T,
class Queue = std::queue<T>,
- typename Traits = fcqueue::type_traits
+ typename Traits = fcqueue::traits
>
class FCQueue
#ifndef CDS_DOXYGEN_INVOKED
public:
typedef T value_type; ///< Value type
typedef Queue queue_type; ///< Sequential queue class
- typedef Traits type_traits; ///< Queue type traits
+ typedef Traits traits; ///< Queue type traits
- typedef typename type_traits::stat stat; ///< Internal statistics type
- static CDS_CONSTEXPR_CONST bool c_bEliminationEnabled = type_traits::enable_elimination; ///< \p true if elimination is enabled
+ typedef typename traits::stat stat; ///< Internal statistics type
+ static CDS_CONSTEXPR const bool c_bEliminationEnabled = traits::enable_elimination; ///< \p true if elimination is enabled
protected:
//@cond
//@endcond
/// Flat combining kernel
- typedef cds::algo::flat_combining::kernel< fc_record, type_traits > fc_kernel;
+ typedef cds::algo::flat_combining::kernel< fc_record, traits > fc_kernel;
protected:
//@cond
return enqueue( val );
}
-# ifdef CDS_MOVE_SEMANTICS_SUPPORT
/// Inserts a new element at the end of the queue (move semantics)
/**
\p val is moved to inserted element
{
return enqueue( val );
}
-# endif
/// Removes the next element from the queue
/**
assert( pRec->pValEnq );
m_Queue.push( *(pRec->pValEnq ) );
break;
-# ifdef CDS_MOVE_SEMANTICS_SUPPORT
case op_enq_move:
assert( pRec->pValEnq );
m_Queue.push( std::move( *(pRec->pValEnq )) );
break;
-# endif
case op_deq:
assert( pRec->pValDeq );
pRec->bEmpty = m_Queue.empty();
goto collided;
}
break;
-# ifdef CDS_MOVE_SEMANTICS_SUPPORT
case op_enq_move:
if ( rec2.op() == op_deq ) {
assert(rec1.pValEnq);
goto collided;
}
break;
-# endif
case op_deq:
switch ( rec2.op() ) {
case op_enq:
-# ifdef CDS_MOVE_SEMANTICS_SUPPORT
case op_enq_move:
-# endif
return collide( rec2, rec1 );
}
}