Source-Changes-HG archive

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

[src/trunk]: src/sys/kern use LIST_FOREACH() macro in proc_stop()/proc_unstop()



details:   https://anonhg.NetBSD.org/src/rev/1d06f61b0c1e
branches:  trunk
changeset: 542789:1d06f61b0c1e
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Fri Feb 07 09:02:14 2003 +0000

description:
use LIST_FOREACH() macro in proc_stop()/proc_unstop()
rewrite contents of the loop in proc_unstop to be a bit more easily
comprehensible

diffstat:

 sys/kern/kern_sig.c |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (58 lines):

diff -r 4eb15845fdb3 -r 1d06f61b0c1e sys/kern/kern_sig.c
--- a/sys/kern/kern_sig.c       Fri Feb 07 04:47:04 2003 +0000
+++ b/sys/kern/kern_sig.c       Fri Feb 07 09:02:14 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sig.c,v 1.131 2003/02/03 22:56:23 jdolecek Exp $  */
+/*     $NetBSD: kern_sig.c,v 1.132 2003/02/07 09:02:14 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.131 2003/02/03 22:56:23 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.132 2003/02/07 09:02:14 jdolecek Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_compat_sunos.h"
@@ -1316,8 +1316,7 @@
         * return to userspace.
         */
           
-       for (l = LIST_FIRST(&p->p_lwps); l != NULL; 
-            l = LIST_NEXT(l, l_sibling)) {
+       LIST_FOREACH(l, &p->p_lwps, l_sibling) {
                if (l->l_stat == LSONPROC) {
                        /* XXX SMP this assumes that a LWP that is LSONPROC
                         * is curlwp and hence is about to be mi_switched 
@@ -1390,17 +1389,18 @@
         */
        if (p->p_flag & P_SA)
                lr = p->p_sa->sa_idle; /* OK if this is NULL. */
-       for (l = LIST_FIRST(&p->p_lwps); l != NULL; 
-            l = LIST_NEXT(l, l_sibling))
-               if (l->l_stat == LSSTOP) {
-                       if (l->l_wchan == 0) {
-                               if (lr == NULL || l == lr)
-                                       lr = l;
-                               else
-                                       setrunnable(l);
-                       } else
-                               l->l_stat = LSSLEEP;
-               }
+       LIST_FOREACH(l, &p->p_lwps, l_sibling) {
+               if (l->l_stat != LSSTOP)
+                       continue;
+
+               if (l->l_wchan == NULL) {
+                       if (lr == NULL)
+                               lr = l;
+                       else if (l != lr)
+                               setrunnable(l);
+               } else
+                       l->l_stat = LSSLEEP;
+       }
 
        return lr;
 }



Home | Main Index | Thread Index | Old Index