From 68a63a4079f2b73dddd3b6f4ac0ad8f09e2a9e01 Mon Sep 17 00:00:00 2001 From: nathanw Date: Mon, 21 Jul 2003 22:14:57 +0000 Subject: [PATCH] Move initialization of variable 'nthreads' so that pthread_exit() from the main thread, with no other threads created, exits cleanly instead of triggering an assertion in pthread_next(). --- lib/libpthread/pthread.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libpthread/pthread.c b/lib/libpthread/pthread.c index 7541b6d7a423..9a5b59e3b77e 100644 --- a/lib/libpthread/pthread.c +++ b/lib/libpthread/pthread.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread.c,v 1.25 2003/07/18 22:33:45 nathanw Exp $ */ +/* $NetBSD: pthread.c,v 1.26 2003/07/21 22:14:57 nathanw Exp $ */ /*- * Copyright (c) 2001,2002,2003 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__RCSID("$NetBSD: pthread.c,v 1.25 2003/07/18 22:33:45 nathanw Exp $"); +__RCSID("$NetBSD: pthread.c,v 1.26 2003/07/21 22:14:57 nathanw Exp $"); #include #include @@ -136,6 +136,7 @@ pthread_init(void) PTQ_INIT(&pthread__reidlequeue); PTQ_INIT(&pthread__runqueue); PTQ_INIT(&pthread__idlequeue); + nthreads = 1; /* Create the thread structure corresponding to main() */ pthread__initmain(&first); @@ -224,7 +225,6 @@ pthread__start(void) pthread__sched_idle(self, idle); } - nthreads = 1; /* Start up the SA subsystem */ pthread__sa_start(); SDPRINTF(("(pthread__start %p) Started.\n", self));