Source-Changes-HG archive

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

[src/trunk]: src/sys Split sys_lwp_suspend, just like sys_lwp_unsuspend is sp...



details:   https://anonhg.NetBSD.org/src/rev/8d0ba0f0c59b
branches:  trunk
changeset: 556709:8d0ba0f0c59b
user:      manu <manu%NetBSD.org@localhost>
date:      Wed Dec 24 22:42:11 2003 +0000

description:
Split sys_lwp_suspend, just like sys_lwp_unsuspend is split. We get
sys_lwp_suspend, with the sanity checks, and lwp_suspend, with the
actual implementation.

diffstat:

 sys/kern/kern_lwp.c |  23 ++++++++++++++++++-----
 sys/sys/lwp.h       |   3 ++-
 2 files changed, 20 insertions(+), 6 deletions(-)

diffs (72 lines):

diff -r 3bc325c7ea2a -r 8d0ba0f0c59b sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c       Wed Dec 24 19:41:09 2003 +0000
+++ b/sys/kern/kern_lwp.c       Wed Dec 24 22:42:11 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lwp.c,v 1.16 2003/12/20 18:22:17 manu Exp $       */
+/*     $NetBSD: kern_lwp.c,v 1.17 2003/12/24 22:42:11 manu Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.16 2003/12/20 18:22:17 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.17 2003/12/24 22:42:11 manu Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -177,8 +177,8 @@
        } */ *uap = v;
        int target_lid;
        struct proc *p = l->l_proc;
-       struct lwp *t, *t2;
-       int s;
+       struct lwp *t;
+       struct lwp *t2;
 
        target_lid = SCARG(uap, target);
 
@@ -201,11 +201,24 @@
 
                if (t2 == NULL) /* All other LWPs are suspended */
                        return (EDEADLK);
+       }
 
+       return lwp_suspend(l, t);
+}
+
+inline int
+lwp_suspend(l, t)
+       struct lwp *l;
+       struct lwp *t;
+{
+       struct proc *p = t->l_proc;
+       int s;
+
+       if (t == l) {
                SCHED_LOCK(s);
                l->l_stat = LSSUSPENDED;
                /* XXX NJWLWP check if this makes sense here: */
-               l->l_proc->p_stats->p_ru.ru_nvcsw++;
+               p->p_stats->p_ru.ru_nvcsw++;
                mi_switch(l, NULL);
                SCHED_ASSERT_UNLOCKED();
                splx(s);
diff -r 3bc325c7ea2a -r 8d0ba0f0c59b sys/sys/lwp.h
--- a/sys/sys/lwp.h     Wed Dec 24 19:41:09 2003 +0000
+++ b/sys/sys/lwp.h     Wed Dec 24 22:42:11 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lwp.h,v 1.15 2003/12/20 18:22:16 manu Exp $    */
+/*     $NetBSD: lwp.h,v 1.16 2003/12/24 22:42:11 manu Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -181,6 +181,7 @@
 void   lwp_exit (struct lwp *);
 void   lwp_exit2 (struct lwp *);
 struct lwp *proc_representative_lwp(struct proc *);
+inline int lwp_suspend(struct lwp *, struct lwp *);
 #endif /* _KERNEL */
 
 /* Flags for _lwp_create(), as per Solaris. */



Home | Main Index | Thread Index | Old Index