summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_stack.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2001-10-26 21:19:22 +0000
committerPeter Wemm <peter@FreeBSD.org>2001-10-26 21:19:22 +0000
commiteb9053b12f317bc99d9e7733d0d18541d7d09e03 (patch)
treeeecbcf12bbd3734f9d86b3bf3acdc1a2169fece3 /lib/libpthread/thread/thr_stack.c
parent0b9272be42bb1779a798e3e67c5f14c6f568488d (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_stack.c')
-rw-r--r--lib/libpthread/thread/thr_stack.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libpthread/thread/thr_stack.c b/lib/libpthread/thread/thr_stack.c
index 055af076c94f..86f0a2dff193 100644
--- a/lib/libpthread/thread/thr_stack.c
+++ b/lib/libpthread/thread/thr_stack.c
@@ -112,8 +112,7 @@ static LIST_HEAD(, stack) _mstackq = LIST_HEAD_INITIALIZER(_mstackq);
* high memory
*
*/
-static void * last_stack = (void *) USRSTACK - PTHREAD_STACK_INITIAL
- - PTHREAD_GUARD_DEFAULT;
+static void * last_stack;
void *
_thread_stack_alloc(size_t stacksize, size_t guardsize)
@@ -186,8 +185,11 @@ _thread_stack_alloc(size_t stacksize, size_t guardsize)
/* Check if a stack was not allocated from a stack cache: */
if (stack == NULL) {
- /* Allocate a new stack. */
+ if (last_stack == NULL)
+ last_stack = _usrstack - PTHREAD_STACK_INITIAL -
+ PTHREAD_GUARD_DEFAULT;
+ /* Allocate a new stack. */
stack = last_stack - stack_size;
/*