Lines Matching full:task
49 struct threadpool_task *task; in threadpool_worker() local
58 /* Pull the first task from the list. We don't free it -- it now lacks in threadpool_worker()
62 task = pool->workqueue; in threadpool_worker()
63 pool->workqueue = task->next; in threadpool_worker()
65 /* Call the task's work func. */ in threadpool_worker()
67 task->work(task->data); in threadpool_worker()
69 task->finished = TRUE; in threadpool_worker()
70 pthread_cond_broadcast(&task->finish); in threadpool_worker()
145 struct threadpool_task *task, *previous; in _mesa_threadpool_queue_task() local
152 task = calloc(1, sizeof(*task)); in _mesa_threadpool_queue_task()
153 if (!task) { in _mesa_threadpool_queue_task()
158 task->work = work; in _mesa_threadpool_queue_task()
159 task->data = data; in _mesa_threadpool_queue_task()
160 task->next = NULL; in _mesa_threadpool_queue_task()
161 pthread_cond_init(&task->finish, NULL); in _mesa_threadpool_queue_task()
166 pool->workqueue = task; in _mesa_threadpool_queue_task()
172 previous->next = task; in _mesa_threadpool_queue_task()
177 return task; in _mesa_threadpool_queue_task()
181 * Blocks on the completion of the given task and frees the task.
187 struct threadpool_task *task = *task_handle; in _mesa_threadpool_wait_for_task() local
189 if (!pool || !task) in _mesa_threadpool_wait_for_task()
193 while (!task->finished) in _mesa_threadpool_wait_for_task()
194 pthread_cond_wait(&task->finish, &pool->m); in _mesa_threadpool_wait_for_task()
197 pthread_cond_destroy(&task->finish); in _mesa_threadpool_wait_for_task()
198 free(task); in _mesa_threadpool_wait_for_task()