From owner-svn-src-all@FreeBSD.ORG Fri Aug 27 13:53:20 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 473841065672; Fri, 27 Aug 2010 13:53:20 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id E022C8FC15; Fri, 27 Aug 2010 13:53:19 +0000 (UTC) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 66F4B45DD8; Fri, 27 Aug 2010 15:53:17 +0200 (CEST) Received: from localhost (pdawidek.whl [10.0.1.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 6E12E45CA6; Fri, 27 Aug 2010 15:53:11 +0200 (CEST) Date: Fri, 27 Aug 2010 15:53:05 +0200 From: Pawel Jakub Dawidek To: David Xu Message-ID: <20100827135305.GB1884@garage.freebsd.pl> References: <201008270323.o7R3N7EP062038@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="24zk1gE8NUlDmwG9" Content-Disposition: inline In-Reply-To: <201008270323.o7R3N7EP062038@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 9.0-CURRENT amd64 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-5.9 required=4.5 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.0.4 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211859 - head/lib/libthr/thread X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Aug 2010 13:53:20 -0000 --24zk1gE8NUlDmwG9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Aug 27, 2010 at 03:23:07AM +0000, David Xu wrote: [...] Hi David. While you at libthr... I found implementation of _pthread_mutex_isowned_np(), which makes me wonder: int _pthread_mutex_isowned_np(pthread_mutex_t *mutex) { struct pthread *curthread =3D _get_curthread(); int ret; if (__predict_false(*mutex =3D=3D NULL)) { ret =3D init_static(curthread, mutex); if (__predict_false(ret)) return (ret); } return ((*mutex)->m_owner =3D=3D curthread); } When init_static() fails, the caller will interpret the answer as 'true', which seems wrong. What does this if statement do exactly? It initializes mutex if it isn't? If so, can't we simply assert that it has to be initialized? --=20 Pawel Jakub Dawidek http://www.wheelsystems.com pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --24zk1gE8NUlDmwG9 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkx3w0EACgkQForvXbEpPzSw0ACeIx4QaDmnoP7j7cYEWGU2+TLn tqYAn2giJzmXTmqxudaZhLb68WLoQZoG =C3ol -----END PGP SIGNATURE----- --24zk1gE8NUlDmwG9--