Date: Fri, 27 Aug 2010 15:53:05 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: David Xu <davidxu@FreeBSD.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r211859 - head/lib/libthr/thread Message-ID: <20100827135305.GB1884@garage.freebsd.pl> In-Reply-To: <201008270323.o7R3N7EP062038@svn.freebsd.org> References: <201008270323.o7R3N7EP062038@svn.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100827135305.GB1884>