/// Metafunction converting option list to traits
/**
\p Options are:
- - \p opt::lock_type - mutex type, default is \p cds::lock::Spin
+ - \p opt::lock_type - mutex type, default is \p cds::sync::spin
- \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: \p fcpqueue::stat, \p fcpqueue::empty_stat (the default)
op_push = cds::algo::flat_combining::req_Operation,
op_push_move,
op_pop,
- op_clear
+ op_clear,
+ op_empty
};
// Flat combining publication list record
/**
If the combining is in process the function waits while combining done.
*/
- bool empty() const
+ bool empty()
{
- m_FlatCombining.wait_while_combining();
- return m_PQueue.empty();
+ fc_record * pRec = m_FlatCombining.acquire_record();
+
+ m_FlatCombining.combine( op_empty, pRec, *this );
+ assert( pRec->is_done() );
+ m_FlatCombining.release_record( pRec );
+ return pRec->bEmpty;
}
/// Internal statistics
{
assert( pRec );
+ // this function is called under FC mutex, so switch TSan off
+ CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
+
switch ( pRec->op() ) {
case op_push:
assert( pRec->pValPush );
while ( !m_PQueue.empty() )
m_PQueue.pop();
break;
+ case op_empty:
+ pRec->bEmpty = m_PQueue.empty();
+ break;
default:
assert(false);
break;
}
+
+ CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
};