| 1590 | |
| 1591 | template<InnerQueueContext context> |
| 1592 | inline bool is_empty() const |
| 1593 | { |
| 1594 | MOODYCAMEL_CONSTEXPR_IF (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) { |
| 1595 | // Check flags |
| 1596 | for (size_t i = 0; i < BLOCK_SIZE; ++i) { |
| 1597 | if (!emptyFlags[i].load(std::memory_order_relaxed)) { |
| 1598 | return false; |
| 1599 | } |
| 1600 | } |
| 1601 | |
| 1602 | // Aha, empty; make sure we have all other memory effects that happened before the empty flags were set |
| 1603 | std::atomic_thread_fence(std::memory_order_acquire); |
| 1604 | return true; |
| 1605 | } |
| 1606 | else { |
| 1607 | // Check counter |
| 1608 | if (elementsCompletelyDequeued.load(std::memory_order_relaxed) == BLOCK_SIZE) { |
| 1609 | std::atomic_thread_fence(std::memory_order_acquire); |
| 1610 | return true; |
| 1611 | } |
| 1612 | assert(elementsCompletelyDequeued.load(std::memory_order_relaxed) <= BLOCK_SIZE); |
| 1613 | return false; |
| 1614 | } |
nothing calls this directly
no test coverage detected