change path_list to path_pool

This commit is contained in:
Ryo Nakamura
2024-02-10 21:29:07 +09:00
parent d2e061fd97
commit bfc955a9a7
6 changed files with 81 additions and 42 deletions

View File

@@ -21,9 +21,21 @@ struct pool_struct {
typedef struct pool_struct pool;
/* allocate a new pool */
pool *pool_new(void);
/* func type applied to each item in a pool*/
typedef void (*pool_map_f)(void *v);
/* apply f, which free an item, to all items and set num to 0 */
void pool_zeroize(pool *p, pool_map_f f);
/* free pool->array and pool */
void pool_free(pool *p);
/* free pool->array and pool after applying f to all items in p->array */
void pool_destroy(pool *p, pool_map_f f);
#define pool_lock(p) LOCK_ACQUIRE(&(p->lock))
#define pool_unlock(p) LOCK_RELEASE()