while ( p ) {
switch ( p->nState.load( memory_model::memory_order_acquire )) {
case active:
- if ( p->op() >= req_Operation ) {
+ if ( p->op( memory_model::memory_order_acquire ) >= req_Operation ) {
p->nAge.store( nCurAge, memory_model::memory_order_relaxed );
owner.fc_apply( static_cast<publication_record_type*>( p ));
operation_done( *p );
compact_list( nCurAge );
}
- bool wait_for_combining( publication_record_type * pRec )
+ bool wait_for_combining( publication_record_type* pRec )
{
m_waitStrategy.prepare( *pRec );
m_Stat.onPassiveWait();
} // namespace flat_combining
}} // namespace cds::algo
+/*
+ CppMem model (http://svr-pes20-cppmem.cl.cam.ac.uk/cppmem/)
+
+ // Combiner thread - slave (waiting) thread
+int main() {
+ atomic_int y = 0; // pRec->op
+ int x = 0; // pRec->data
+ {{{
+ { // slave thread (not combiner)
+ // Op data
+ x = 1;
+ // Annotate request (op)
+ y.store(1, release);
+ // Wait while request done
+ y.load(acquire).readsvalue(2);
+ // Read result
+ r2=x;
+ }
+ |||
+ { // Combiner thread
+ // Read request (op)
+ r1=y.load(acquire).readsvalue(1);
+ // Execute request - change request data
+ x = 2;
+ // store "request processed" flag (pRec->op := req_Response)
+ y.store(2, release);
+ }
+ }}};
+ return 0;
+}
+
+*/
+
#endif // #ifndef CDSLIB_ALGO_FLAT_COMBINING_KERNEL_H
{
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_front:
assert( pRec->pValPush );
assert(false);
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
/// Batch-processing flat combining
{
typedef typename fc_kernel::iterator fc_iterator;
- // this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
-
for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) {
- switch ( it->op()) {
+ switch ( it->op( atomics::memory_order_acquire )) {
case op_push_front:
if ( itPrev != itEnd
&& (itPrev->op() == op_pop_front || (m_Deque.empty() && itPrev->op() == op_pop_back)))
break;
}
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
assert( pRec );
// this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
switch ( pRec->op()) {
case op_push:
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
};
{
assert( pRec );
- // this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
-
switch ( pRec->op()) {
case op_enq:
assert( pRec->pValEnq );
assert(false);
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
/// Batch-processing flat combining
{
typedef typename fc_kernel::iterator fc_iterator;
- // this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
-
for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) {
- switch ( it->op()) {
+ switch ( it->op( atomics::memory_order_acquire )) {
case op_enq:
case op_enq_move:
case op_deq:
break;
}
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
{
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 );
assert(false);
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
/// Batch-processing flat combining
void fc_process( typename fc_kernel::iterator itBegin, typename fc_kernel::iterator itEnd )
{
// this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
typedef typename fc_kernel::iterator fc_iterator;
for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) {
- switch ( it->op()) {
+ switch ( it->op( atomics::memory_order_acquire )) {
case op_push:
case op_push_move:
case op_pop:
break;
}
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
// this function is called under FC mutex, so switch TSan off
// All TSan warnings are false positive
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
switch ( pRec->op()) {
case op_enq:
assert(false);
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
/// Batch-processing flat combining
{
// this function is called under FC mutex, so switch TSan off
// All TSan warnings are false positive
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
typedef typename fc_kernel::iterator fc_iterator;
for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) {
- switch ( it->op()) {
+ switch ( it->op( atomics::memory_order_acquire )) {
case op_enq:
case op_deq:
if ( m_Queue.empty()) {
break;
}
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
+ //CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond
return m_FlatCombining.statistics();
}
-
public: // flat combining cooperation, not for direct use!
//@cond
/// Flat combining supporting function. Do not call it directly!
{
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->pVal );
assert(false);
break;
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
/// Batch-processing flat combining
void fc_process( typename fc_kernel::iterator itBegin, typename fc_kernel::iterator itEnd )
{
- // this function is called under FC mutex, so switch TSan off
- CDS_TSAN_ANNOTATE_IGNORE_RW_BEGIN;
-
typedef typename fc_kernel::iterator fc_iterator;
for ( fc_iterator it = itBegin, itPrev = itEnd; it != itEnd; ++it ) {
- switch ( it->op()) {
+ switch ( it->op( atomics::memory_order_acquire )) {
case op_push:
case op_pop:
if ( itPrev != itEnd && collide( *itPrev, *it ))
break;
}
}
- CDS_TSAN_ANNOTATE_IGNORE_RW_END;
}
//@endcond