Lines Matching refs:curthread
77 static void thr_destroy(struct pthread *curthread, struct pthread *thread);
99 _thr_gc(struct pthread *curthread) in _thr_gc() argument
105 THREAD_LIST_WRLOCK(curthread); in _thr_gc()
117 THREAD_LIST_UNLOCK(curthread); in _thr_gc()
130 _thr_free(curthread, td); in _thr_gc()
135 _thr_alloc(struct pthread *curthread) in _thr_alloc() argument
140 if (curthread != NULL) { in _thr_alloc()
142 _thr_gc(curthread); in _thr_alloc()
144 THR_LOCK_ACQUIRE(curthread, &free_thread_lock); in _thr_alloc()
149 THR_LOCK_RELEASE(curthread, &free_thread_lock); in _thr_alloc()
163 thr_destroy(curthread, thread); in _thr_alloc()
171 if (curthread != NULL) { in _thr_alloc()
172 THR_LOCK_ACQUIRE(curthread, &tcb_lock); in _thr_alloc()
174 THR_LOCK_RELEASE(curthread, &tcb_lock); in _thr_alloc()
181 thr_destroy(curthread, thread); in _thr_alloc()
189 _thr_free(struct pthread *curthread, struct pthread *thread) in _thr_free() argument
198 if (curthread != NULL) { in _thr_free()
199 THR_LOCK_ACQUIRE(curthread, &tcb_lock); in _thr_free()
201 THR_LOCK_RELEASE(curthread, &tcb_lock); in _thr_free()
206 if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { in _thr_free()
207 thr_destroy(curthread, thread); in _thr_free()
214 THR_LOCK_ACQUIRE(curthread, &free_thread_lock); in _thr_free()
217 THR_LOCK_RELEASE(curthread, &free_thread_lock); in _thr_free()
222 thr_destroy(struct pthread *curthread __unused, struct pthread *thread) in thr_destroy()
236 _thr_link(struct pthread *curthread, struct pthread *thread) in _thr_link() argument
238 THREAD_LIST_WRLOCK(curthread); in _thr_link()
240 THREAD_LIST_UNLOCK(curthread); in _thr_link()
248 _thr_unlink(struct pthread *curthread, struct pthread *thread) in _thr_unlink() argument
250 THREAD_LIST_WRLOCK(curthread); in _thr_unlink()
252 THREAD_LIST_UNLOCK(curthread); in _thr_unlink()
291 _thr_ref_add(struct pthread *curthread, struct pthread *thread, in _thr_ref_add() argument
300 if ((ret = _thr_find_thread(curthread, thread, include_dead)) == 0) { in _thr_ref_add()
302 THR_CRITICAL_ENTER(curthread); in _thr_ref_add()
303 THR_THREAD_UNLOCK(curthread, thread); in _thr_ref_add()
311 _thr_ref_delete(struct pthread *curthread, struct pthread *thread) in _thr_ref_delete() argument
313 THR_THREAD_LOCK(curthread, thread); in _thr_ref_delete()
315 _thr_try_gc(curthread, thread); in _thr_ref_delete()
316 THR_CRITICAL_LEAVE(curthread); in _thr_ref_delete()
321 _thr_try_gc(struct pthread *curthread, struct pthread *thread) in _thr_try_gc() argument
324 THR_REF_ADD(curthread, thread); in _thr_try_gc()
325 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
326 THREAD_LIST_WRLOCK(curthread); in _thr_try_gc()
327 THR_THREAD_LOCK(curthread, thread); in _thr_try_gc()
328 THR_REF_DEL(curthread, thread); in _thr_try_gc()
333 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
334 THREAD_LIST_UNLOCK(curthread); in _thr_try_gc()
336 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
342 _thr_find_thread(struct pthread *curthread, struct pthread *thread, in _thr_find_thread() argument
352 THREAD_LIST_RDLOCK(curthread); in _thr_find_thread()
355 THR_THREAD_LOCK(curthread, pthread); in _thr_find_thread()
357 THR_THREAD_UNLOCK(curthread, pthread); in _thr_find_thread()
363 THREAD_LIST_UNLOCK(curthread); in _thr_find_thread()
382 struct pthread *curthread, *thrd; in __pthread_distribute_static_tls() local
390 curthread = _get_curthread(); in __pthread_distribute_static_tls()
391 THREAD_LIST_RDLOCK(curthread); in __pthread_distribute_static_tls()
396 THREAD_LIST_UNLOCK(curthread); in __pthread_distribute_static_tls()