1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

readded check for correct queue size (accidentally removed)

This commit is contained in:
Steffen Vogel 2016-10-30 15:39:05 -04:00
parent fb30c16d2b
commit 893c723385

View file

@ -36,6 +36,11 @@
/** Initialize MPMC queue */
int queue_init(struct queue *q, size_t size, const struct memtype *mem)
{
/* Queue size must be 2 exponent */
if (!IS_POW2(size))
return -1;
q->mem = mem;
q->buffer_mask = size - 1;
q->buffer = memory_alloc(q->mem, sizeof(q->buffer[0]) * size);