• Home
  • Raw
  • Download

Lines Matching full:pool

43     struct threadpool *pool = data;  in threadpool_worker()  local
45 pthread_mutex_lock(&pool->m); in threadpool_worker()
47 while (!pool->shutdown) { in threadpool_worker()
51 while (!pool->workqueue && !pool->shutdown) in threadpool_worker()
52 pthread_cond_wait(&pool->new_work, &pool->m); in threadpool_worker()
54 if (pool->shutdown) { in threadpool_worker()
55 pthread_mutex_unlock(&pool->m); in threadpool_worker()
63 task = pool->workqueue; in threadpool_worker()
64 pool->workqueue = task->next; in threadpool_worker()
67 pthread_mutex_unlock(&pool->m); in threadpool_worker()
69 pthread_mutex_lock(&pool->m); in threadpool_worker()
74 pthread_mutex_unlock(&pool->m); in threadpool_worker()
82 struct threadpool *pool = calloc(1, sizeof(*pool)); in _mesa_threadpool_create() local
84 if (!pool) in _mesa_threadpool_create()
87 pthread_mutex_init(&pool->m, NULL); in _mesa_threadpool_create()
88 pthread_cond_init(&pool->new_work, NULL); in _mesa_threadpool_create()
90 pool->wthread = NineSwapChain9_CreateThread(swapchain, threadpool_worker, pool); in _mesa_threadpool_create()
91 if (!pool->wthread) { in _mesa_threadpool_create()
93 pthread_create(&pool->pthread, NULL, threadpool_worker, pool); in _mesa_threadpool_create()
95 return pool; in _mesa_threadpool_create()
99 _mesa_threadpool_destroy(struct NineSwapChain9 *swapchain, struct threadpool *pool) in _mesa_threadpool_destroy() argument
101 if (!pool) in _mesa_threadpool_destroy()
104 pthread_mutex_lock(&pool->m); in _mesa_threadpool_destroy()
105 pool->shutdown = TRUE; in _mesa_threadpool_destroy()
106 pthread_cond_broadcast(&pool->new_work); in _mesa_threadpool_destroy()
107 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_destroy()
109 if (pool->wthread) { in _mesa_threadpool_destroy()
110 NineSwapChain9_WaitForThread(swapchain, pool->wthread); in _mesa_threadpool_destroy()
112 pthread_join(pool->pthread, NULL); in _mesa_threadpool_destroy()
115 pthread_cond_destroy(&pool->new_work); in _mesa_threadpool_destroy()
116 pthread_mutex_destroy(&pool->m); in _mesa_threadpool_destroy()
117 free(pool); in _mesa_threadpool_destroy()
122 * thread pool.
132 _mesa_threadpool_queue_task(struct threadpool *pool, in _mesa_threadpool_queue_task() argument
137 if (!pool) { in _mesa_threadpool_queue_task()
153 pthread_mutex_lock(&pool->m); in _mesa_threadpool_queue_task()
155 if (!pool->workqueue) { in _mesa_threadpool_queue_task()
156 pool->workqueue = task; in _mesa_threadpool_queue_task()
158 previous = pool->workqueue; in _mesa_threadpool_queue_task()
164 pthread_cond_signal(&pool->new_work); in _mesa_threadpool_queue_task()
165 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_queue_task()
174 _mesa_threadpool_wait_for_task(struct threadpool *pool, in _mesa_threadpool_wait_for_task() argument
179 if (!pool || !task) in _mesa_threadpool_wait_for_task()
182 pthread_mutex_lock(&pool->m); in _mesa_threadpool_wait_for_task()
184 pthread_cond_wait(&task->finish, &pool->m); in _mesa_threadpool_wait_for_task()
185 pthread_mutex_unlock(&pool->m); in _mesa_threadpool_wait_for_task()