MCPcopy Create free account
hub / github.com/NetSys/bess / LockLessQueue

Method LockLessQueue

core/utils/lock_less_queue.h:56–65  ·  view source on GitHub ↗

Construct a new queue. Takes the size of backing ring buffer (must power of two and entries available will be one less than specified. default is 256), boolean where if true, queue is in single producer mode or if false, queue is in multi producer mode, boolean where if true, queue is in single consumer mode, or if false, queue is in multi consumer mode. default for both booleans is true.

Source from the content-addressed store, hash-verified

54 // consumer mode, or if false, queue is in multi consumer mode. default for
55 // both booleans is true.
56 LockLessQueue(size_t capacity = kDefaultRingSize, bool single_producer = true,
57 bool single_consumer = true)
58 : capacity_(capacity) {
59 CHECK((capacity & (capacity - 1)) == 0);
60 size_t ring_sz = llring_bytes_with_slots(capacity_);
61 ring_ = reinterpret_cast<struct llring*>(
62 aligned_alloc(alignof(llring), ring_sz));
63 CHECK(ring_);
64 llring_init(ring_, capacity_, single_producer, single_consumer);
65 }
66
67 virtual ~LockLessQueue() {
68 if (ring_) {

Callers

nothing calls this directly

Calls 2

llring_bytes_with_slotsFunction · 0.85
llring_initFunction · 0.85

Tested by

no test coverage detected