MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / is_empty

Method is_empty

deps/concurrentqueue/concurrentqueue.h:1549–1568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1547
1548 template<InnerQueueContext context>
1549 inline bool is_empty() const
1550 {
1551 MOODYCAMEL_CONSTEXPR_IF (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) {
1552 // Check flags
1553 for (size_t i = 0; i < BLOCK_SIZE; ++i) {
1554 if (!emptyFlags[i].load(std::memory_order_relaxed)) {
1555 return false;
1556 }
1557 }
1558
1559 // Aha, empty; make sure we have all other memory effects that happened before the empty flags were set
1560 std::atomic_thread_fence(std::memory_order_acquire);
1561 return true;
1562 }
1563 else {
1564 // Check counter
1565 if (elementsCompletelyDequeued.load(std::memory_order_relaxed) == BLOCK_SIZE) {
1566 std::atomic_thread_fence(std::memory_order_acquire);
1567 return true;
1568 }
1569 assert(elementsCompletelyDequeued.load(std::memory_order_relaxed) <= BLOCK_SIZE);
1570 return false;
1571 }

Callers

nothing calls this directly

Calls 1

MOODYCAMEL_CONSTEXPR_IFFunction · 0.85

Tested by

no test coverage detected