Allow to query capacity of MPMC queue

This is in preparation to grow the queue as needed.
This commit is contained in:
Robin Gareus
2022-05-12 00:40:31 +02:00
parent c87a5cdcfd
commit 5ca76789c5

View File

@@ -26,6 +26,7 @@
#include <cassert>
#include <stdint.h>
#include <stdlib.h>
#ifdef MPMC_USE_STD_ATOMIC
# include <atomic>
@@ -59,6 +60,10 @@ public:
delete[] _buffer;
}
size_t capacity () const {
return _buffer_mask + 1;
}
static size_t
power_of_two_size (size_t sz)
{
@@ -126,7 +131,6 @@ public:
break;
}
} else if (dif < 0) {
assert (0);
return false;
} else {
#ifdef MPMC_USE_STD_ATOMIC