pthread_attr_setstacksize(&attr, p->stack_size ? : ucwlib_thread_stack_size) < 0)
ASSERT(0);
- for (uns i=0; i < p->num_threads; i++)
+ for (uint i=0; i < p->num_threads; i++)
{
struct worker_thread *t = (p->new_thread ? p->new_thread() : xmalloc(sizeof(*t)));
t->pool = p;
void
worker_pool_cleanup(struct worker_pool *p)
{
- for (uns i=0; i < p->num_threads; i++)
+ for (uint i=0; i < p->num_threads; i++)
{
struct work w = {
.go = worker_thread_signal_finish
q->pri_heap = xrealloc(old_heap, (q->heap_max + 1) * sizeof(struct work *));
}
struct work **heap = q->pri_heap;
- heap[++q->heap_cnt] = w;
- HEAP_INSERT(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
+ HEAP_INSERT(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP, w);
}
pthread_mutex_unlock(&q->queue_mutex);
sem_post(q->queue_sem);
{
struct work **heap = q->pri_heap;
w = heap[1];
- HEAP_DELMIN(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
+ HEAP_DELETE_MIN(struct work *, heap, q->heap_cnt, PRI_LESS, HEAP_SWAP);
}
pthread_mutex_unlock(&q->queue_mutex);
return w;
struct w {
struct work w;
- uns id;
+ uint id;
};
static void go(struct worker_thread *t, struct work *w)
struct work_queue q;
work_queue_init(&pool, &q);
- for (uns i=0; i<500; i++)
+ for (uint i=0; i<500; i++)
{
struct w *w = xmalloc_zero(sizeof(*w));
w->w.go = go;