Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Update comments



details:   https://anonhg.NetBSD.org/src/rev/0c9bb42163ec
branches:  trunk
changeset: 744352:0c9bb42163ec
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Jan 30 12:36:38 2020 +0000

description:
Update comments

diffstat:

 sys/kern/sys_lwp.c |  18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diffs (44 lines):

diff -r 11c16659a5c8 -r 0c9bb42163ec sys/kern/sys_lwp.c
--- a/sys/kern/sys_lwp.c        Thu Jan 30 12:28:51 2020 +0000
+++ b/sys/kern/sys_lwp.c        Thu Jan 30 12:36:38 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_lwp.c,v 1.74 2020/01/29 15:47:52 ad Exp $  */
+/*     $NetBSD: sys_lwp.c,v 1.75 2020/01/30 12:36:38 ad Exp $  */
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.74 2020/01/29 15:47:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_lwp.c,v 1.75 2020/01/30 12:36:38 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -480,15 +480,21 @@
                        continue;
                }
 
-               /* It may not have parked yet or we may have raced. */
                lwp_lock(t);
                if (t->l_syncobj == &lwp_park_syncobj) {
-                       /* Releases the LWP lock. */
+                       /*
+                        * As expected it's parked, so wake it up. 
+                        * lwp_unsleep() will release the LWP lock.
+                        */
                        lwp_unsleep(t, true);
                } else {
                        /*
-                        * Set the operation pending.  The next call to
-                        * _lwp_park() will return early.
+                        * It hasn't parked yet because the wakeup side won
+                        * the race, or something else has happened to make
+                        * the thread not park.  Why doesn't really matter. 
+                        * Set the operation pending, so that the next call
+                        * to _lwp_park() in the LWP returns early.  If it
+                        * turns out to be a spurious wakeup, no harm done.
                         */
                        t->l_flag |= LW_UNPARKED;
                        lwp_unlock(t);



Home | Main Index | Thread Index | Old Index