MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / is_empty

Method is_empty

source/util/concurrentqueue.h:1570–1589  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1568
1569 template<InnerQueueContext context>
1570 inline bool is_empty() const
1571 {
1572 MOODYCAMEL_CONSTEXPR_IF (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) {
1573 // Check flags
1574 for (size_t i = 0; i < BLOCK_SIZE; ++i) {
1575 if (!emptyFlags[i].load(std::memory_order_relaxed)) {
1576 return false;
1577 }
1578 }
1579
1580 // Aha, empty; make sure we have all other memory effects that happened before the empty flags were set
1581 std::atomic_thread_fence(std::memory_order_acquire);
1582 return true;
1583 }
1584 else {
1585 // Check counter
1586 if (elementsCompletelyDequeued.load(std::memory_order_relaxed) == BLOCK_SIZE) {
1587 std::atomic_thread_fence(std::memory_order_acquire);
1588 return true;
1589 }
1590 assert(elementsCompletelyDequeued.load(std::memory_order_relaxed) <= BLOCK_SIZE);
1591 return false;
1592 }

Callers

nothing calls this directly

Calls 3

MOODYCAMEL_CONSTEXPR_IFFunction · 0.85
ifFunction · 0.50
loadMethod · 0.45

Tested by

no test coverage detected