commit 062c80c1acc83a5cc92fc1d0b5731670403dd1ee
parent 71c145932c8d546533a44f35268a4f5949f36905
Author: Joris Vink <joris@coders.se>
Date: Tue, 30 Oct 2018 10:41:49 +0100
start enforcing a mininum number of elms in pools.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/pool.c b/src/pool.c
@@ -21,6 +21,8 @@
#include "kore.h"
+#define POOL_MIN_ELEMENTS 16
+
#define POOL_ELEMENT_BUSY 0
#define POOL_ELEMENT_FREE 1
@@ -38,6 +40,9 @@ kore_pool_init(struct kore_pool *pool, const char *name,
{
kore_debug("kore_pool_init(%p, %s, %zu, %zu)", pool, name, len, elm);
+ if (elm < POOL_MIN_ELEMENTS)
+ elm = POOL_MIN_ELEMENTS;
+
if ((pool->name = strdup(name)) == NULL)
fatal("kore_pool_init: strdup %s", errno_s);