Lines Matching refs:curthread
75 static void thr_destroy(struct pthread *curthread, struct pthread *thread);
97 _thr_gc(struct pthread *curthread) in _thr_gc() argument
103 THREAD_LIST_WRLOCK(curthread); in _thr_gc()
115 THREAD_LIST_UNLOCK(curthread); in _thr_gc()
128 _thr_free(curthread, td); in _thr_gc()
133 _thr_alloc(struct pthread *curthread) in _thr_alloc() argument
138 if (curthread != NULL) { in _thr_alloc()
140 _thr_gc(curthread); in _thr_alloc()
142 THR_LOCK_ACQUIRE(curthread, &free_thread_lock); in _thr_alloc()
147 THR_LOCK_RELEASE(curthread, &free_thread_lock); in _thr_alloc()
161 thr_destroy(curthread, thread); in _thr_alloc()
169 if (curthread != NULL) { in _thr_alloc()
170 THR_LOCK_ACQUIRE(curthread, &tcb_lock); in _thr_alloc()
172 THR_LOCK_RELEASE(curthread, &tcb_lock); in _thr_alloc()
179 thr_destroy(curthread, thread); in _thr_alloc()
187 _thr_free(struct pthread *curthread, struct pthread *thread) in _thr_free() argument
196 if (curthread != NULL) { in _thr_free()
197 THR_LOCK_ACQUIRE(curthread, &tcb_lock); in _thr_free()
199 THR_LOCK_RELEASE(curthread, &tcb_lock); in _thr_free()
204 if ((curthread == NULL) || (free_thread_count >= MAX_CACHED_THREADS)) { in _thr_free()
205 thr_destroy(curthread, thread); in _thr_free()
212 THR_LOCK_ACQUIRE(curthread, &free_thread_lock); in _thr_free()
215 THR_LOCK_RELEASE(curthread, &free_thread_lock); in _thr_free()
220 thr_destroy(struct pthread *curthread __unused, struct pthread *thread) in thr_destroy()
234 _thr_link(struct pthread *curthread, struct pthread *thread) in _thr_link() argument
236 THREAD_LIST_WRLOCK(curthread); in _thr_link()
238 THREAD_LIST_UNLOCK(curthread); in _thr_link()
246 _thr_unlink(struct pthread *curthread, struct pthread *thread) in _thr_unlink() argument
248 THREAD_LIST_WRLOCK(curthread); in _thr_unlink()
250 THREAD_LIST_UNLOCK(curthread); in _thr_unlink()
289 _thr_ref_add(struct pthread *curthread, struct pthread *thread, in _thr_ref_add() argument
298 if ((ret = _thr_find_thread(curthread, thread, include_dead)) == 0) { in _thr_ref_add()
300 THR_CRITICAL_ENTER(curthread); in _thr_ref_add()
301 THR_THREAD_UNLOCK(curthread, thread); in _thr_ref_add()
309 _thr_ref_delete(struct pthread *curthread, struct pthread *thread) in _thr_ref_delete() argument
311 THR_THREAD_LOCK(curthread, thread); in _thr_ref_delete()
313 _thr_try_gc(curthread, thread); in _thr_ref_delete()
314 THR_CRITICAL_LEAVE(curthread); in _thr_ref_delete()
319 _thr_try_gc(struct pthread *curthread, struct pthread *thread) in _thr_try_gc() argument
322 THR_REF_ADD(curthread, thread); in _thr_try_gc()
323 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
324 THREAD_LIST_WRLOCK(curthread); in _thr_try_gc()
325 THR_THREAD_LOCK(curthread, thread); in _thr_try_gc()
326 THR_REF_DEL(curthread, thread); in _thr_try_gc()
331 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
332 THREAD_LIST_UNLOCK(curthread); in _thr_try_gc()
334 THR_THREAD_UNLOCK(curthread, thread); in _thr_try_gc()
340 _thr_find_thread(struct pthread *curthread, struct pthread *thread, in _thr_find_thread() argument
350 THREAD_LIST_RDLOCK(curthread); in _thr_find_thread()
353 THR_THREAD_LOCK(curthread, pthread); in _thr_find_thread()
355 THR_THREAD_UNLOCK(curthread, pthread); in _thr_find_thread()
361 THREAD_LIST_UNLOCK(curthread); in _thr_find_thread()
380 struct pthread *curthread, *thrd; in __pthread_distribute_static_tls() local
388 curthread = _get_curthread(); in __pthread_distribute_static_tls()
389 THREAD_LIST_RDLOCK(curthread); in __pthread_distribute_static_tls()
394 THREAD_LIST_UNLOCK(curthread); in __pthread_distribute_static_tls()