From d1e30ddcd16d4d7217ba77db099fe1c9bbe85803 Mon Sep 17 00:00:00 2001 From: jasone Date: Sun, 11 Jul 1999 05:56:37 +0000 Subject: Modify previous changes to conform better to libc_r's coding style. Always use mmap() for default-size stack allocation. Use MAP_ANON instead of MAP_STACK on the alpha architecture. Reduce the amount of code executed while owning _gc_mutex during stack allocation. --- lib/libpthread/thread/thr_init.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/libpthread/thread/thr_init.c') diff --git a/lib/libpthread/thread/thr_init.c b/lib/libpthread/thread/thr_init.c index a5b7a82..f5e2c45 100644 --- a/lib/libpthread/thread/thr_init.c +++ b/lib/libpthread/thread/thr_init.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: uthread_init.c,v 1.13 1999/07/05 00:35:19 jasone Exp $ + * $Id: uthread_init.c,v 1.14 1999/07/06 00:25:38 jasone Exp $ */ /* Allocate space for global thread variables here: */ @@ -180,15 +180,17 @@ _thread_init(void) /* Initialize the scheduling switch hook routine: */ _sched_switch_hook = NULL; -#ifdef __i386__ /* Initialize the thread stack cache: */ SLIST_INIT(&_stackq); /* Create the red zone for the main stack. */ - if (MAP_FAILED == mmap((void *) PTHREAD_STACK_TOP - PTHREAD_STACK_INITIAL, PTHREAD_STACK_GUARD, 0, MAP_ANON, -1, 0)) { + if (mmap((void *) PTHREAD_STACK_TOP + - PTHREAD_STACK_INITIAL, + PTHREAD_STACK_GUARD, 0, MAP_ANON, + -1, 0) == MAP_FAILED) { PANIC("Cannot allocate red zone for initial thread"); } -#endif + /* * Write a magic value to the thread structure * to help identify valid ones: -- cgit v1.1