Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libpthread_dbg td_map_lwps(): there's always one lwp. Th...



details:   https://anonhg.NetBSD.org/src/rev/d2c4e60b266d
branches:  trunk
changeset: 567146:d2c4e60b266d
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Wed Jun 02 21:15:42 2004 +0000

description:
td_map_lwps(): there's always one lwp. This makes the call work before
the thread system has started.

Additionally, mark not-on-LWP threads explicitly, so that there's no
risk of using stale information.

diffstat:

 lib/libpthread_dbg/pthread_dbg.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 35206c36eb4b -r d2c4e60b266d lib/libpthread_dbg/pthread_dbg.c
--- a/lib/libpthread_dbg/pthread_dbg.c  Wed Jun 02 21:13:42 2004 +0000
+++ b/lib/libpthread_dbg/pthread_dbg.c  Wed Jun 02 21:15:42 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_dbg.c,v 1.17 2004/06/02 21:13:42 nathanw Exp $ */
+/*     $NetBSD: pthread_dbg.c,v 1.18 2004/06/02 21:15:42 nathanw Exp $ */
 
 /*-
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_dbg.c,v 1.17 2004/06/02 21:13:42 nathanw Exp $");
+__RCSID("$NetBSD: pthread_dbg.c,v 1.18 2004/06/02 21:15:42 nathanw Exp $");
 
 #include <stddef.h>
 #include <stdlib.h>
@@ -917,6 +917,13 @@
        if (val != 0)
                return val;
 
+       if (nlwps < 1)
+               nlwps = 1; /* always at least one LWP */
+
+       PTQ_FOREACH(thread, &proc->threads, list) {
+               thread->lwp = -1;
+       }
+
        for (i = 1; i <= nlwps; i++) {
                /*
                 * Errors are deliberately ignored for the call to



Home | Main Index | Thread Index | Old Index