Allow to query capacity of MPMC queue
This is in preparation to grow the queue as needed.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user