Source-Changes-HG archive

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

[src/nathanw_sa]: src/sys/kern Prevent entering exit1() from multiple LWPs in...



details:   https://anonhg.NetBSD.org/src/rev/59800a37fe60
branches:  nathanw_sa
changeset: 504827:59800a37fe60
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Mon Jul 09 22:31:55 2001 +0000

description:
Prevent entering exit1() from multiple LWPs in a process.
Use setrunnable() instead of tweaking l_stat and calling setrunnable();
avoids the embarassment of having swapped-out LWPs on the run queue.

diffstat:

 sys/kern/kern_exit.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r ede9e3f58e2c -r 59800a37fe60 sys/kern/kern_exit.c
--- a/sys/kern/kern_exit.c      Mon Jul 09 22:29:47 2001 +0000
+++ b/sys/kern/kern_exit.c      Mon Jul 09 22:31:55 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exit.c,v 1.89.2.2 2001/04/09 01:57:52 nathanw Exp $       */
+/*     $NetBSD: kern_exit.c,v 1.89.2.3 2001/07/09 22:31:55 nathanw Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -134,6 +134,10 @@
                syscallarg(int) rval;
        } */ *uap = v;
 
+       /* Don't call exit1() multiple times in the same process.*/
+       if (l->l_proc->p_flag & P_WEXIT)
+               lwp_exit(l);
+
        exit1(l, W_EXITCODE(SCARG(uap, rval), 0));
        /* NOTREACHED */
        return (0);
@@ -195,18 +199,16 @@
         * also self-destruct.
         */
        if (p->p_sa && p->p_sa->sa_ncached > 0) {
-               DPRINTF(("exit1: Placing cached LWPs of %d on run queue: ",
+               DPRINTF(("exit1: Making cached LWPs of %d runnable: ",
                    p->p_pid));
                while (!LIST_EMPTY(&p->p_sa->sa_lwpcache)) {
                        l2 = LIST_FIRST(&p->p_sa->sa_lwpcache);
                        LIST_REMOVE(l2, l_sibling);
                        p->p_sa->sa_ncached--;
                        l2->l_priority = l2->l_usrpri;
-                       l2->l_stat = LSRUN;
                        SCHED_LOCK(s);
-                       setrunqueue(l2);
+                       setrunnable(l2);
                        SCHED_UNLOCK(s);
-
                        LIST_INSERT_HEAD(&p->p_lwps, l2, l_sibling);
                        p->p_nlwps++;
                        p->p_nrlwps++;



Home | Main Index | Thread Index | Old Index