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:
parent
fb30c16d2b
commit
893c723385
1 changed files with 5 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue