assert(!inSection&&"Concurrent (or re-entrant) enqueue or dequeue operation detected (only one thread at a time may hold the producer or consumer role)");
"Concurrent (or re-entrant) enqueue or dequeue operation detected (only one thread at a time may hold the producer or consumer role)");
inSection=true;
}
AE_NO_TSAN~ReentrantGuard(){inSection=false;}
private:
ReentrantGuard&operator=(ReentrantGuardconst&);
private:
ReentrantGuard&operator=(ReentrantGuardconst&);
private:
weak_atomic<bool>&inSection;
};
private:
weak_atomic<bool>&inSection;
};
#endif
structBlock
{
structBlock{
// Avoid false-sharing by putting highly contended variables on their own cache lines
weak_atomic<size_t>front;// (Atomic) Elements are read from here
size_tlocalTail;// An uncontended shadow copy of tail, owned by the consumer
...
...
@@ -702,75 +691,73 @@ struct Block
weak_atomic<size_t>tail;// (Atomic) Elements are enqueued here
size_tlocalFront;
charcachelineFiller1[MOODYCAMEL_CACHE_LINE_SIZE-sizeof(weak_atomic<size_t>)-sizeof(size_t)];// next isn't very contended, but we don't want it on the same cache line as tail (which is)