diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 08:31:33 +0000 |
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-25 08:31:33 +0000 |
| commit | 71d09bc86add29bb88cb5cf14e1403077f9b512c (patch) | |
| tree | 8d4a439b258befa57524829fe1e00a861d962282 /lib/libthr/thread/thr_stack.c | |
| parent | 6a1899ed5c328e9ef8706a375fa54b463a59d4c0 (diff) | |
Notes
Diffstat (limited to 'lib/libthr/thread/thr_stack.c')
| -rw-r--r-- | lib/libthr/thread/thr_stack.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/libthr/thread/thr_stack.c b/lib/libthr/thread/thr_stack.c index c75d6eeb7786..28b396bc90f4 100644 --- a/lib/libthr/thread/thr_stack.c +++ b/lib/libthr/thread/thr_stack.c @@ -144,8 +144,7 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) * Use the garbage collector mutex for synchronization of the * spare stack list. */ - if (pthread_mutex_lock(&_gc_mutex) != 0) - PANIC("Cannot lock gc mutex"); + DEAD_LIST_LOCK; if ((spare_stack = LIST_FIRST(&_dstackq)) != NULL) { /* Use the spare stack. */ @@ -154,8 +153,7 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) } /* Unlock the garbage collector mutex. */ - if (pthread_mutex_unlock(&_gc_mutex) != 0) - PANIC("Cannot unlock gc mutex"); + DEAD_LIST_UNLOCK; } /* * The user specified a non-default stack and/or guard size, so try to @@ -167,8 +165,7 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) * Use the garbage collector mutex for synchronization of the * spare stack list. */ - if (pthread_mutex_lock(&_gc_mutex) != 0) - PANIC("Cannot lock gc mutex"); + DEAD_LIST_LOCK; LIST_FOREACH(spare_stack, &_mstackq, qe) { if (spare_stack->stacksize == stack_size && @@ -180,8 +177,7 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) } /* Unlock the garbage collector mutex. */ - if (pthread_mutex_unlock(&_gc_mutex) != 0) - PANIC("Cannot unlock gc mutex"); + DEAD_LIST_UNLOCK; } /* Check if a stack was not allocated from a stack cache: */ @@ -212,7 +208,7 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize) return (stack); } -/* This function must be called with _gc_mutex held. */ +/* This function must be called with the 'dead thread list' lock held. */ void _thread_stack_free(void *stack, size_t stacksize, size_t guardsize) { |
