summaryrefslogtreecommitdiff
path: root/src/pool.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pool.h')
-rw-r--r--src/pool.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pool.h b/src/pool.h
index 4d8e283..875a84b 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-3.0-only */
#ifndef _POOL_H_
#define _POOL_H_
@@ -57,6 +58,7 @@ void *pool_pop_lock(pool *p);
void *pool_get(pool *p, unsigned int idx);
#define pool_size(p) ((p)->num)
+#define pool_is_empty(p) (pool_size(p) == 0)
/*
* pool->idx indicates next *v in an iteration. This has two
@@ -77,6 +79,11 @@ void *pool_get(pool *p, unsigned int idx);
void *pool_iter_next(pool *p);
void *pool_iter_next_lock(pool *p);
+/* pool_iter_check_next_lock() returns true if pool_iter_next(_lock)
+ * function will retrun a next value, otherwise false, which means
+ * there is no more values in this iteration. */
+bool pool_iter_check_next_lock(pool *p);
+
#define pool_iter_for_each(p, v) \
pool_iter_init(p); \
for (v = pool_iter_next(p); v != NULL; v = pool_iter_next(p))