/// Metafunction converting option list to \p basket_queue::traits
/**
Supported \p Options are:
-
- - opt::hook - hook used. Possible hooks are: \p basket_queue::base_hook, \p basket_queue::member_hook, \p basket_queue::traits_hook.
+ - \p opt::hook - hook used. Possible hooks are: \p basket_queue::base_hook, \p basket_queue::member_hook, \p basket_queue::traits_hook.
If the option is not specified, \p %basket_queue::base_hook<> is used.
- - opt::back_off - back-off strategy used, default is \p cds::backoff::empty.
- - opt::disposer - the functor used for dispose removed items. Default is \p opt::v::empty_disposer. This option is used
+ - \p opt::back_off - back-off strategy used, default is \p cds::backoff::empty.
+ - \p opt::disposer - the functor used for dispose removed items. Default is \p opt::v::empty_disposer. This option is used
when dequeuing.
- - opt::link_checker - the type of node's link fields checking. Default is \p opt::debug_check_link
- - opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter (item counting disabled)
+ - \p opt::link_checker - the type of node's link fields checking. Default is \p opt::debug_check_link
+ - \p opt::item_counter - the type of item counting feature. Default is \p cds::atomicity::empty_item_counter (item counting disabled)
To enable item counting use \p cds::atomicity::item_counter
- - opt::stat - the type to gather internal statistics.
+ - \p opt::stat - the type to gather internal statistics.
Possible statistics types are: \p basket_queue::stat, \p basket_queue::empty_stat, user-provided class that supports \p %basket_queue::stat interface.
Default is \p %basket_queue::empty_stat (internal statistics disabled).
- \p opt::padding - padding for internal critical atomic data. Default is \p opt::cache_line_padding
- - opt::memory_model - C++ memory ordering model. Can be \p opt::v::relaxed_ordering (relaxed memory model, the default)
+ - \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).
Example: declare \p %BasketQueue with item counting and internal statistics
of the backoff mechanisms to reduce contention, making the algorithm an attractive
out-of-the-box queue.
- In order to enqueue, just as in MSQueue, a thread first tries to link the new node to
+ In order to enqueue, just as in \p MSQueue, a thread first tries to link the new node to
the last node. If it failed to do so, then another thread has already succeeded. Thus it
tries to insert the new node into the new basket that was created by the winner thread.
To dequeue a node, a thread first reads the head of the queue to obtain the
typedef GC gc ; ///< Garbage collector
typedef Tag tag ; ///< tag
- typedef typename gc::template atomic_ref<node> atomic_node_ptr ; ///< atomic pointer
+ typedef typename gc::template atomic_ref<node> atomic_node_ptr; ///< atomic pointer
/// Rebind node for other template parameters
template <class GC2, typename Tag2 = tag>
namespace cds { namespace intrusive {
- /// FCQueue related definitions
+ /// \p FCQueue related definitions
namespace fcqueue {
- /// FCQueue internal statistics
+ /// \p FCQueue internal statistics
template <typename Counter = cds::atomicity::event_counter >
struct stat: public cds::algo::flat_combining::stat<Counter>
{
//@endcond
};
- /// FCQueue type traits
+ /// \p FCQueue type traits
struct traits: public cds::algo::flat_combining::traits
{
typedef cds::intrusive::opt::v::empty_disposer disposer ; ///< Disposer to erase removed elements. Used only in \p FCQueue::clear() function
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.
+ By default, the elimination is disabled (\p false)
*/
template <typename... Options>
struct make_traits {
frequently, our modification will reduce the number of accesses to global memory. This modification, however,
introduces the possibility of \p Head and \p Tail 'crossing'."
- Explanation of template arguments see intrusive::MSQueue.
+ Explanation of template arguments see \p intrusive::MSQueue.
\par Examples
\code
namespace cds { namespace intrusive {
- /// OptimisticQueue related definitions
+ /// \p OptimisticQueue related definitions
/** @ingroup cds_intrusive_helper
*/
namespace optimistic_queue {
/// Base hook
/**
\p Options are:
- - opt::gc - garbage collector used.
- - opt::tag - a \ref cds_intrusive_hook_tag "tag"
+ - \p opt::gc - garbage collector used.
+ - \p opt::tag - a \ref cds_intrusive_hook_tag "tag"
*/
template < typename... Options >
struct base_hook: public hook< opt::base_hook_tag, Options... >
Use \p offsetof macro to define \p MemberOffset
\p Options are:
- - opt::gc - garbage collector used.
- - opt::tag - a \ref cds_intrusive_hook_tag "tag"
+ - \p opt::gc - garbage collector used.
+ - \p opt::tag - a \ref cds_intrusive_hook_tag "tag"
*/
template < size_t MemberOffset, typename... Options >
struct member_hook: public hook< opt::member_hook_tag, Options... >
See \ref node_traits for \p NodeTraits interface description
\p Options are:
- - opt::gc - garbage collector used.
- - opt::tag - a \ref cds_intrusive_hook_tag "tag"
+ - \p opt::gc - garbage collector used.
+ - \p opt::tag - a \ref cds_intrusive_hook_tag "tag"
*/
template <typename NodeTraits, typename... Options >
struct traits_hook: public hook< opt::traits_hook_tag, Options... >
};
//@endcond
- /// OptimisticQueue internal statistics. May be used for debugging or profiling
+ /// \p OptimisticQueue internal statistics. May be used for debugging or profiling
/**
Template argument \p Counter defines type of counter.
- Default is \p cds::atomicity::event_counter, that is weak, i.e. it is not guaranteed
- strict event counting.
+ Default is \p cds::atomicity::event_counter.
You may use stronger type of counter like as \p cds::atomicity::item_counter,
or even integral type, for example, \p int.
*/
//@endcond
};
- /// Dummy OptimisticQueue statistics - no counting is performed. Support interface like \ref optimistic_queue::stat
+ /// Dummy \p OptimisticQueue statistics - no counting is performed. Support interface like \p optimistic_queue::stat
struct empty_stat
{
//@cond
//@endcond
};
- /// OptimisticQueue default type traits
+ /// \p OptimisticQueue default type traits
struct traits
{
/// Back-off strategy
typedef OptimisticQueue< GC2, T2, Traits2 > other ; ///< Rebinding result
};
+ static CDS_CONSTEXPR const size_t c_nHazardPtrCount = 5; ///< Count of hazard pointer required for the algorithm
+
protected:
//@cond
typedef typename node_type::atomic_node_ptr atomic_node_ptr;
item_counter m_ItemCounter ; ///< Item counter
stat m_Stat ; ///< Internal statistics
- static CDS_CONSTEXPR const size_t c_nHazardPtrCount = 5 ; ///< Count of hazard pointer required for the algorithm
-
protected:
//@cond
static void clear_links( node_type * pNode )
| ... |
\endcode
- \p dequeue function returns Item 2, that becomes new top of queue, and calls
+ \p %dequeue() function returns Item 2, that becomes new top of queue, and calls
the disposer for Item 1, that was queue's top on function entry.
Thus, you cannot manually delete item returned because it is still included in
- item sequence and it has valuable link field that must not be zeroed.
+ the queue and it has valuable link field that must not be zeroed.
The item may be deleted only in disposer call.
*/
value_type * dequeue()