Source-Changes-HG archive

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

[src/trunk]: src/sys lwp_setlock(): return pointer to the kmutex_t that we re...



details:   https://anonhg.NetBSD.org/src/rev/ee5c74721c28
branches:  trunk
changeset: 461285:ee5c74721c28
user:      ad <ad%NetBSD.org@localhost>
date:      Thu Nov 21 19:47:21 2019 +0000

description:
lwp_setlock(): return pointer to the kmutex_t that we replaced

diffstat:

 sys/kern/kern_lwp.c |  14 ++++++++------
 sys/sys/lwp.h       |   4 ++--
 2 files changed, 10 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r c0d2e656fa50 -r ee5c74721c28 sys/kern/kern_lwp.c
--- a/sys/kern/kern_lwp.c       Thu Nov 21 19:27:54 2019 +0000
+++ b/sys/kern/kern_lwp.c       Thu Nov 21 19:47:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_lwp.c,v 1.210 2019/11/21 18:22:05 ad Exp $        */
+/*     $NetBSD: kern_lwp.c,v 1.211 2019/11/21 19:47:21 ad Exp $        */
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -211,7 +211,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.210 2019/11/21 18:22:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.211 2019/11/21 19:47:21 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -1475,14 +1475,16 @@
 /*
  * Lend a new mutex to an LWP.  The old mutex must be held.
  */
-void
+kmutex_t *
 lwp_setlock(struct lwp *l, kmutex_t *mtx)
 {
+       kmutex_t *oldmtx = l->l_mutex;
 
-       KASSERT(mutex_owned(l->l_mutex));
+       KASSERT(mutex_owned(oldmtx));
 
        membar_exit();
        l->l_mutex = mtx;
+       return oldmtx;
 }
 
 /*
@@ -1517,11 +1519,11 @@
 }
 
 void
-lwp_unsleep(lwp_t *l, bool cleanup)
+lwp_unsleep(lwp_t *l, bool unlock)
 {
 
        KASSERT(mutex_owned(l->l_mutex));
-       (*l->l_syncobj->sobj_unsleep)(l, cleanup);
+       (*l->l_syncobj->sobj_unsleep)(l, unlock);
 }
 
 /*
diff -r c0d2e656fa50 -r ee5c74721c28 sys/sys/lwp.h
--- a/sys/sys/lwp.h     Thu Nov 21 19:27:54 2019 +0000
+++ b/sys/sys/lwp.h     Thu Nov 21 19:47:21 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lwp.h,v 1.188 2019/11/14 16:23:53 maxv Exp $   */
+/*     $NetBSD: lwp.h,v 1.189 2019/11/21 19:47:21 ad Exp $     */
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010
@@ -326,7 +326,7 @@
 void   startlwp(void *);
 
 int    lwp_locked(lwp_t *, kmutex_t *);
-void   lwp_setlock(lwp_t *, kmutex_t *);
+kmutex_t *lwp_setlock(lwp_t *, kmutex_t *);
 void   lwp_unlock_to(lwp_t *, kmutex_t *);
 int    lwp_trylock(lwp_t *);
 void   lwp_addref(lwp_t *);



Home | Main Index | Thread Index | Old Index