Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Feb 2023 00:27:13 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 06e6efccbfab - stable/13 - libthr: add pshared_destroy() helper
Message-ID:  <202302080027.3180RDGs096550@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=06e6efccbfab46410ff7b9e034353453ea19ac3d

commit 06e6efccbfab46410ff7b9e034353453ea19ac3d
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-02-01 21:06:04 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-02-08 00:26:59 +0000

    libthr: add pshared_destroy() helper
    
    (cherry picked from commit 3cf37d1251bf71b2171e67af8f2ca43cbe3d874d)
---
 lib/libthr/thread/thr_pshared.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/lib/libthr/thread/thr_pshared.c b/lib/libthr/thread/thr_pshared.c
index d0219d0488f4..37b44ab73582 100644
--- a/lib/libthr/thread/thr_pshared.c
+++ b/lib/libthr/thread/thr_pshared.c
@@ -213,6 +213,17 @@ pshared_clean(void *key, void *val)
 	_umtx_op(NULL, UMTX_OP_SHM, UMTX_SHM_DESTROY, key, NULL);
 }
 
+static void
+pshared_destroy(struct pthread *curthread, void *key)
+{
+	void *val;
+
+	pshared_wlock(curthread);
+	val = pshared_remove(key);
+	pshared_unlock(curthread);
+	pshared_clean(key, val);
+}
+
 void *
 __thr_pshared_offpage(void *key, int doalloc)
 {
@@ -248,13 +259,9 @@ void
 __thr_pshared_destroy(void *key)
 {
 	struct pthread *curthread;
-	void *val;
 
 	curthread = _get_curthread();
-	pshared_wlock(curthread);
-	val = pshared_remove(key);
-	pshared_unlock(curthread);
-	pshared_clean(key, val);
+	pshared_destroy(curthread, key);
 	pshared_gc(curthread);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302080027.3180RDGs096550>