• Home
  • Raw
  • Download

Lines Matching refs:pool

26     struct threadpool *pool = data;  in threadpool_worker()  local
28 pthread_mutex_lock(&pool->m); in threadpool_worker()
30 while (!pool->shutdown) { in threadpool_worker()
34 while (!pool->workqueue && !pool->shutdown) in threadpool_worker()
35 pthread_cond_wait(&pool->new_work, &pool->m); in threadpool_worker()
37 if (pool->shutdown) in threadpool_worker()
44 task = pool->workqueue; in threadpool_worker()
45 pool->workqueue = task->next; in threadpool_worker()
48 pthread_mutex_unlock(&pool->m); in threadpool_worker()
50 pthread_mutex_lock(&pool->m); in threadpool_worker()
55 pthread_mutex_unlock(&pool->m); in threadpool_worker()
72 struct threadpool *pool = calloc(1, sizeof(*pool)); in _mesa_threadpool_create() local
74 if (!pool) in _mesa_threadpool_create()
77 pthread_mutex_init(&pool->m, NULL); in _mesa_threadpool_create()
78 pthread_cond_init(&pool->new_work, NULL); in _mesa_threadpool_create()
82 pool->wthread = NineSwapChain9_CreateThread(swapchain, wthreadpool_worker, pool); in _mesa_threadpool_create()
83 if (!pool->wthread) { in _mesa_threadpool_create()
85 pthread_create(&pool->pthread, NULL, threadpool_worker, pool); in _mesa_threadpool_create()
87 return pool; in _mesa_threadpool_create()
91 _mesa_threadpool_destroy(struct NineSwapChain9 *swapchain, struct threadpool *pool) in _mesa_threadpool_destroy() argument
93 if (!pool) in _mesa_threadpool_destroy()
96 pthread_mutex_lock(&pool->m); in _mesa_threadpool_destroy()
97 pool->shutdown = true; in _mesa_threadpool_destroy()
98 pthread_cond_broadcast(&pool->new_work); in _mesa_threadpool_destroy()
99 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_destroy()
101 if (pool->wthread) { in _mesa_threadpool_destroy()
102 NineSwapChain9_WaitForThread(swapchain, pool->wthread); in _mesa_threadpool_destroy()
104 pthread_join(pool->pthread, NULL); in _mesa_threadpool_destroy()
107 pthread_cond_destroy(&pool->new_work); in _mesa_threadpool_destroy()
108 pthread_mutex_destroy(&pool->m); in _mesa_threadpool_destroy()
109 free(pool); in _mesa_threadpool_destroy()
124 _mesa_threadpool_queue_task(struct threadpool *pool, in _mesa_threadpool_queue_task() argument
129 if (!pool) { in _mesa_threadpool_queue_task()
145 pthread_mutex_lock(&pool->m); in _mesa_threadpool_queue_task()
147 if (!pool->workqueue) { in _mesa_threadpool_queue_task()
148 pool->workqueue = task; in _mesa_threadpool_queue_task()
150 previous = pool->workqueue; in _mesa_threadpool_queue_task()
156 pthread_cond_signal(&pool->new_work); in _mesa_threadpool_queue_task()
157 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_queue_task()
166 _mesa_threadpool_wait_for_task(struct threadpool *pool, in _mesa_threadpool_wait_for_task() argument
171 if (!pool || !task) in _mesa_threadpool_wait_for_task()
174 pthread_mutex_lock(&pool->m); in _mesa_threadpool_wait_for_task()
176 pthread_cond_wait(&task->finish, &pool->m); in _mesa_threadpool_wait_for_task()
177 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_wait_for_task()