From nobody Sun Feb 04 11:51:59 2024 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 4TSSXw1jGQz59dZV; Sun, 4 Feb 2024 11:52:00 +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 4TSSXw17rKz4NJx; Sun, 4 Feb 2024 11:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707047520; 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=i3N/6jy1p243hQfcWwae6YwVO1aNpNcsUJSYjcAo7CE=; b=dSP83FGEneGpbZVym/3OvL2ITsy5YuL7qnAQzWl2pW9SljeI2rVvfQOBhZBRy15u2gLMUg 3QJ0RlzFWpQXZl42CgaDfK5IcmdcWw5kANxwKwJ1zBCmVZwXI3owlFp/egoDBzUhGoIFlv Y6qEOvSE8qgDERNWLV0U9B+e59ghv6bpqUgkntgGTzZWU6u0CKC95dSQdJPS/hbaW5nOlm 5TVcnTfY9c1nArXizzhV9WrtYkE0qz4GTM6AGUBN4Y6GbxX8RMKZ+L8hXgW7TrDfCre/s6 BeGdH+ht7PX4SmtcNqbTdCnUZ3RZ6UMWKYWjBnBO9uNcjMUtAxBtlcBFLen2tQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1707047520; 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=i3N/6jy1p243hQfcWwae6YwVO1aNpNcsUJSYjcAo7CE=; b=Cy/dTeosASS63Vpvzvbv/yP7D1H6G/JVECKqd54RJkl7YS8B9q7YgHAbupcx0gAVspr/Ay 8RFknncUMWHxfe5czsep1IeSvV4oihFvvrdB2LTmebv2Ph7kRb8rCv+4y+kVL3FvjJwcfA rh6Z6ObimBLT+OXMT8s3/6vTGPvAkYComlv6Wtq5O8xBqngBoZResAfsGK8IyeCyw96ArJ oF7RuwryWP9+Sv7sfTmdGMsME8GrVTUpcP72QGeIzRKmsLihoI2hDkFmPglEKMZ0klbPB/ qnnUKyq+P6eWGg8RzjxnyC27QSYITktCxYAoiZ6XTckDRMmFCqm8lLssHI1Eeg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1707047520; a=rsa-sha256; cv=none; b=sSLb+NgEvO1+qlHppzRwORLHFs6NEv12FyA786FQaYxsSZgrXiPrc01uL07+6iZmBJ33oD w/tvE6NQhWXXWchs8X04mB8msLEM7NKDP87hE5CEEuM5uaR8hiqsZ6axT/LNceTOh9iUOG fJKRmEYiTKL+oY0Y18YNunZ+jjqzuu9XZcLUsbM5D8+GvdwKVqiw4BWctE1IsYgrdxVDqy otJxPU0niVtd9NhLRASQ6z3IxNvUbJ/JK8YT5uJPtSevDnUMkaMsRsinqXlzzF5Aa/43UO 3yFbDaa35RMGddHqQneTyeHgY4jp2cLcRtuM1QBJd/ckMHW0sLl9w4RT0Pmyww== 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 4TSSXw02kmzwDX; Sun, 4 Feb 2024 11:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 414Bpx00074318; Sun, 4 Feb 2024 11:51:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 414Bpxg7074315; Sun, 4 Feb 2024 11:51:59 GMT (envelope-from git) Date: Sun, 4 Feb 2024 11:51:59 GMT Message-Id: <202402041151.414Bpxg7074315@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: a03f768612ad - main - libstdthreads: destroy mutexattr in mtx_init() 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: a03f768612ad98a886458197c531a0b92203bf84 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a03f768612ad98a886458197c531a0b92203bf84 commit a03f768612ad98a886458197c531a0b92203bf84 Author: Hodong AuthorDate: 2024-02-04 10:14:22 +0000 Commit: Konstantin Belousov CommitDate: 2024-02-04 11:50:56 +0000 libstdthreads: destroy mutexattr in mtx_init() PR: 276818 MFC after: 1 week --- lib/libstdthreads/mtx.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/libstdthreads/mtx.c b/lib/libstdthreads/mtx.c index 719ba6486e41..3027a4e48c8d 100644 --- a/lib/libstdthreads/mtx.c +++ b/lib/libstdthreads/mtx.c @@ -43,7 +43,7 @@ int mtx_init(mtx_t *mtx, int type) { pthread_mutexattr_t attr; - int mt; + int mt, res; switch (type) { case mtx_plain: @@ -60,11 +60,12 @@ mtx_init(mtx_t *mtx, int type) if (pthread_mutexattr_init(&attr) != 0) return (thrd_error); - if (pthread_mutexattr_settype(&attr, mt) != 0) - return (thrd_error); - if (pthread_mutex_init(mtx, &attr) != 0) - return (thrd_error); - return (thrd_success); + res = thrd_success; + if (pthread_mutexattr_settype(&attr, mt) != 0 || + pthread_mutex_init(mtx, &attr) != 0) + res = thrd_error; + pthread_mutexattr_destroy(&attr); + return (res); } int