MCPcopy Create free account
hub / github.com/dmlc/dmlc-core / set_empty

Method set_empty

include/dmlc/concurrentqueue.h:1527–1543  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1525 // Returns true if the block is now empty (does not apply in explicit context)
1526 template<InnerQueueContext context>
1527 inline bool set_empty(index_t i) {
1528 if (context == explicit_context && BLOCK_SIZE <= EXPLICIT_BLOCK_EMPTY_COUNTER_THRESHOLD) {
1529 // Set flag
1530 assert(!emptyFlags[BLOCK_SIZE - 1 -
1531 static_cast<size_t>(i & static_cast<index_t>(BLOCK_SIZE - 1))].load(
1532 std::memory_order_relaxed));
1533 emptyFlags[BLOCK_SIZE - 1 -
1534 static_cast<size_t>(i & static_cast<index_t>(BLOCK_SIZE - 1))].store(true,
1535 std::memory_order_release);
1536 return false;
1537 } else {
1538 // Increment counter
1539 auto prevVal = elementsCompletelyDequeued.fetch_add(1, std::memory_order_release);
1540 assert(prevVal < BLOCK_SIZE);
1541 return prevVal == BLOCK_SIZE - 1;
1542 }
1543 }
1544
1545 // Sets multiple contiguous item statuses to 'empty' (assumes no wrapping and count > 0).
1546 // Returns true if the block is now empty (does not apply in explicit context).

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected