summaryrefslogtreecommitdiff
path: root/src/pool.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pool.c')
-rw-r--r--src/pool.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pool.c b/src/pool.c
index ce9dfcd..e4026ae 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -61,6 +61,7 @@ int pool_push(pool *p, void *v)
p->array = new;
}
p->array[p->num] = v;
+ __sync_synchronize();
p->num++;
return 0;
}
@@ -88,6 +89,11 @@ void *pool_pop_lock(pool *p)
return v;
}
+void *pool_get(pool *p, unsigned int idx)
+{
+ return p->num <= idx ? NULL : p->array[idx];
+}
+
void *pool_iter_next(pool *p)
{
if (p->num <= p->idx)