Source-Changes-HG archive

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

[src/trunk]: src/sys/rump/librump/rumpkern these days make sure we have an lw...



details:   https://anonhg.NetBSD.org/src/rev/65e0e2fbbb72
branches:  trunk
changeset: 761462:65e0e2fbbb72
user:      pooka <pooka%NetBSD.org@localhost>
date:      Fri Jan 28 17:57:03 2011 +0000

description:
these days make sure we have an lwp lock (for lwp walker smiths)

diffstat:

 sys/rump/librump/rumpkern/sleepq.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r c02f437b1388 -r 65e0e2fbbb72 sys/rump/librump/rumpkern/sleepq.c
--- a/sys/rump/librump/rumpkern/sleepq.c        Fri Jan 28 17:04:39 2011 +0000
+++ b/sys/rump/librump/rumpkern/sleepq.c        Fri Jan 28 17:57:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sleepq.c,v 1.12 2011/01/27 21:55:25 pooka Exp $        */
+/*     $NetBSD: sleepq.c,v 1.13 2011/01/28 17:57:03 pooka Exp $        */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.12 2011/01/27 21:55:25 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.13 2011/01/28 17:57:03 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -87,12 +87,14 @@
        int biglocks = l->l_biglocks;
 
        while (l->l_wchan) {
-               l->l_mutex = mp;
+               l->l_mutex = mp; /* keep sleepq lock until woken up */
                error = cv_timedwait(&sq_cv, mp, timo);
                if (error == EWOULDBLOCK || error == EINTR) {
-                       TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain);
-                       l->l_wchan = NULL;
-                       l->l_wmesg = NULL;
+                       if (l->l_wchan) {
+                               TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain);
+                               l->l_wchan = NULL;
+                               l->l_wmesg = NULL;
+                       }
                }
        }
        mutex_spin_exit(mp);
@@ -118,7 +120,6 @@
                        found = true;
                        l->l_wchan = NULL;
                        l->l_wmesg = NULL;
-                       l->l_mutex = NULL;
                        TAILQ_REMOVE(sq, l, l_sleepchain);
                }
        }
@@ -135,7 +136,6 @@
 
        l->l_wchan = NULL;
        l->l_wmesg = NULL;
-       l->l_mutex = NULL;
        TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain);
        cv_broadcast(&sq_cv);
 



Home | Main Index | Thread Index | Old Index