change thread_list to thread_pool

This commit is contained in:
Ryo Nakamura
2024-02-10 22:34:03 +09:00
parent bfc955a9a7
commit d6f437bcb1
4 changed files with 39 additions and 46 deletions

View File

@@ -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)