From nobody Wed Feb 01 23:41:37 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P6djZ1yKXz3cMGC; Wed, 1 Feb 2023 23:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6djZ0hxPz3Nhm; Wed, 1 Feb 2023 23:41:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675294898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=H9bWSPTVtenUPrC1OKFMy3BrCUbJY5dLI8CnvfK9iCY=; b=kEiw9QkaopLtgYGdvYJVFUUk/DF93ZCbjGneS3V2M5GD4QyLLOPsLC2hGO4jUtZmaEBDgz fVO1Yts607lOmbPECBdj6w5NTJvu8U1+fV5EWie+Ocz5+tuNl/XB0/ndV8Ft6M3zhJ3ym3 bzO3eTU8XoRRbNkyPqMR7GEGJSzcbTedTr+8de3Kj50VXKn/WpMbMi7Sp4d2GRPS2+b+oP PP1SAaF0eDrEqjB3XvzYPCTJjg9VJ+cIMMv9vAWa4Aghk4ZgYy7euHEnEzO9DA4TmId+mz 40AQonF96JKrHGz1mCa8SwG5Ncm4q/I0I5Pvez9vATCr5T4v0Gve9bjQ9Rh7Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675294898; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=H9bWSPTVtenUPrC1OKFMy3BrCUbJY5dLI8CnvfK9iCY=; b=X+tW4Fh82AV9T/gsq454IX/ROuci0aIRljesF/1ubmEVV4sUrhCvdGsCSMbFWSg82l7Dvn ET0LsCRIIZHqiUybyUTe5DoSgKD/qJ1EzbSHxWcfHXOen44LXOd43rZ28J0R43tk5omlHa 6H7Hrubcwyc9tDfAHVpI/UB6PwHBvygBPjehJ+1L1xZ+9VB5/NQg/1f1qissN6mahktxwV NH4As4KKIoN8dPwp7IGceOpbjy3OWqdpihlJw9S28Flkl5CTrmyUPN4+NvGMntRoMlZtsd /W+cDdN0MdfzTc/EeJYujepw8gW+Xzvkl0pp90zp3gGbpng/7XALI5jQN2NSQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675294898; a=rsa-sha256; cv=none; b=CCDih1gF4saO6lQjM3UM8KnvGFXcUecLZFyOegxrdZ2/VeRuT/i+RwQlwTsaqho9Tc3MQV t4lDWbY82miDk8+RrY/Y+g6k33mix1ij7hCnwQRTLamKaeZSI8tlfhjtg332b0ndUrYJw1 czeeaLqPpjk61/PFR1ZphBy+Esrrz0tjqJU6fHeW6Spbjx52rrBbgMl22TNmhQjY/9rY0o hjPbKTzjpVIS1vudb9TCJSXqtQrEFoF9cU92UMXVPj6URRt5kA8vDd+z1y0KeR0CiAjSVR Q1sq2DzGV+rnGsyZH88HNOnoUeAqmEqa/KVMciJVRW1nw6smgpG1L4gccBKbeg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P6djY6gkmzYNX; Wed, 1 Feb 2023 23:41:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311Nfbsf088974; Wed, 1 Feb 2023 23:41:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311NfbLO088973; Wed, 1 Feb 2023 23:41:37 GMT (envelope-from git) Date: Wed, 1 Feb 2023 23:41:37 GMT Message-Id: <202302012341.311NfbLO088973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3cf37d1251bf - main - libthr: add pshared_destroy() helper List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cf37d1251bf71b2171e67af8f2ca43cbe3d874d Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3cf37d1251bf71b2171e67af8f2ca43cbe3d874d commit 3cf37d1251bf71b2171e67af8f2ca43cbe3d874d Author: Konstantin Belousov AuthorDate: 2023-02-01 21:06:04 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-01 22:59:27 +0000 libthr: add pshared_destroy() helper Rewviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38345 --- 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); }